第一题是:随机产生10个不多于两位的整数,存入一个一维数组中,对这10个数从小到大进行排列,要求在当前窗体上显示排序前和排序后的数据。
第二题是:程序运行后,自动在列表框(名为list)中列出计算机中的各种字体,悬着相应的字体后,标签(名为labell)中的文字用这种字体显示。
Private Sub Command1_Click()
Dim a(1 To 10) As Integer, i As Integer, j As Integer, iMin As Integer
Print "排序前的数组为:"
For i = 1 To 10
a(i) = Int(Rnd * 100)
Print a(i);
Next i
Print "排序后的数组为:"
For i = 1 To 9
iMin = i
For j = i + 1 To 10
If a(j) < a(iMin) Then iMin = j
Next j
t = a(iMin): a(iMin) = a(i): a(i) = t
Next i
For i = 1 To 10
Print a(i);
Next i
End Sub
单击两次后的效果
Private Sub Form_Load()
Label1.Caption = "Visual Bacic程序设计"
Label1.FontSize = 20
List1.List(0) = "隶书"
List1.List(1) = "宋体"
List1.List(2) = "黑体"
End Sub
Private Sub List1_Click()
If List1.Selected(0) = True Then
Label1.FontName = "隶书"
ElseIf List1.Selected(1) = True Then
Label1.FontName = "宋体"
ElseIf List1.Selected(2) = True Then
Label1.FontName = "黑体"
End If
End Sub
第二题运行结果:
请一定采纳哦!
追问还有第二题您能帮忙做一下么?
追答已经答了哦!!!