【加试题】小郭编写一个最大数查找的VB程序,功能如下:程序运行时,在文本框Text1中输入一个数字字符串,单击命令按钮Command1,在文本框Text2中输出最大3位整数(每个数字字符不可重复使用)。程序运行界面如图所示。实现上述功能的VB程序如下。请在画线处填入适当的语句和代码,把程序补充完整。Dim w As Integer ‘变量w用于存储每次最大数字字符的位置Private Sub Command1_Click() Dim t As String Dim i As Integer,j As Integer Dim max As Integer,S As Integer t=Text1.Text s=0 For i=3 To 1 Step-1 max=0 For j=1 To Len(t) If Val(Mid(t,j,1))>max Then max=Val(Mid(t,j,1)) ① End If Next j s=s+ ② t=delmax(t) Next i Text2.Text=Str(s)End Sub‘自定义函数功能是去除当前最大数字字符Function delmax(t As String)As String delmax= ③ End Function
(1)
在程序画线①处应填入;
(2)
在程序画线②处应填入;
(3)
在程序画线③处应填入。
答案: 【1】w=j
【1】max*10^(i-1)
【1】Mid(t,1,w-1)+Mid(t,w+1,Len(t)-w)