Dim x%, y%, z%, a
Private Sub Command1_Click()
Randomize Timer
x = Int(Rnd * 100 + 1)
y = Int(Rnd * 100 + 1)
z = Int(Rnd * 100 + 1)
Print
If x < y Then
a = x
x = y
y = a
End If 'x
a = y
y = z
z = a 'y
If x < y Then
a = x
x = y
y = a
End If 'x
End Sub
给你个数组排序的吧
Dim a(3) As Integer
'输入你的数字
Dim temp As Integer
For j As Integer = 1 To 2
If a(j) < a(j + 1) Then
temp = a(j + 1)
a(j + 1) = a(j)
a(j) = temp
End If
Next
Dim
x%,
y%,
z%,
a
Private
Sub
Command1_Click()
Randomize
Timer
x
=
Int(Rnd
*
100
+
1)
y
=
Int(Rnd
*
100
+
1)
z
=
Int(Rnd
*
100
+
1)
Print
If
x
<
y
Then
a
=
x
x
=
y
y
=
a
End
If
'x
y
<
z
Then
a
=
y
y
=
z
z
=
a
'y
If
If
x
<
y
Then
a
=
x
x
=
y
y
=
a
End
If
'x
Tab(5);
"随机产生数字从大到小排序:";
x;
y;
z
End
Sub
Dim
x%,
y%,
z%,
a
Private
Sub
Command1_Click()
Randomize
Timer
x
=
Int(Rnd
*
100
+
1)
y
=
Int(Rnd
*
100
+
1)
z
=
Int(Rnd
*
100
+
1)
Print
If
x
<
y
Then
a
=
x
x
=
y
y
=
a
End
If
'x
评论
0
0
加载更多