修改时间:2021-05-20 浏览次数:119 类型:月考试卷
Dim a(1 To 7) As Integer
a(1) = 14: a(2) = 15: a(3) = 0: a(4) = 11: a(5) = 13: a(6) = 21: a(7) = 17
i = 6: flag = True
Do While i > 1 And flag
If a(i) Mod 3 = 0 And a(i) <> 0 Then
t = a(i): a(i) = a(i + 1): a(i + 1) = t
ElseIf a(i) = 0 Then
flag = flase
ElseIf a(i + 1) Mod 2 = 1 Then
a(i) = Abs(a(i) - a(i + 1))
End If
i = i - 1
Loop
实现上述功能的VB程序如下,请在划线处填入合适的代码。
Dim a(1 To 100)As Integer
Dim n As Integer
Private Sub Command1_Click() '生成n个有序数,显示在List1中
’有序代码略
End Sub
Private Sub Command2_ Click)
Dim t As Integer,i As Integer,j As Integer,temp As Integer
t=Val(Text2.Text)
For
Temp=
For j=i To i+1-t Step -1
a(j)=a(j-1)
Next j
Next i
For i=1 To n
List2.AddItem Str(a(i))
Next i
End Sub
Private Sub Cmd1_Click( )
Dim a1 As String,a2 As String,sum As String,t As String
Dim b1 As Integer,b2 As Integer
Dim dist As Integer,x As Integer,jw As Integer
a1=Text1.Text: a2=Text2.Text: sum=" "
dist=Len(a1)-Len(a2)
If dist<0 Then
t=a1: a1=a2: a2=t
End If
For i=1 To dist
a2="0"+a2
Next i
jw=0
For i=
If Mid(a1, i, 1)>="A" And Mid(a1, i, 1)<="F" Then
b1=Asc(a1)-55
Else
b1=Val(Mid(a1, i, 1))
End If
If Mid(a2, i, 1)>="A" And Mid(a2, i, 1)<="F" Then
b2=Asc(a2)-55
Else
b2=Val(Mid(a2, i, 1))
End If
x=b1+b2+jw
If Then
sum=Chr(x Mod 16+55)+sum
Else
sum=Str(x Mod 16)+sum
End If
Next i
If jw=1 Then sum="1"+sum
Text3. Text=sum
End Sub
试题篮