用VB改写这个C
答案:2 悬赏:80 手机版
解决时间 2021-03-31 23:09
- 提问者网友:太高姿态
- 2021-03-31 10:37
用VB改写这个C
最佳答案
- 五星知识达人网友:酒醒三更
- 2021-03-31 10:47
Private Sub Command1_Click()
Dim a(1 To 4) As Integer
Dim i As Integer, j As Integer, t As Integer
Print "请输入四个数"
For i = 1 To 4
a(i) = Val(InputBox("a[" & i & "]="))
Next
For i = 1 To 4
For j = i + 1 To 4
If a(i) > a(j) Then
t = a(i)
a(i) = a(j)
a(j) = t
End If
Next
Next
Print "排序后"
For i = 1 To 4
Print a(i)
Next
End Sub追问谢谢高手啊
Dim a(1 To 4) As Integer
Dim i As Integer, j As Integer, t As Integer
Print "请输入四个数"
For i = 1 To 4
a(i) = Val(InputBox("a[" & i & "]="))
Next
For i = 1 To 4
For j = i + 1 To 4
If a(i) > a(j) Then
t = a(i)
a(i) = a(j)
a(j) = t
End If
Next
Next
Print "排序后"
For i = 1 To 4
Print a(i)
Next
End Sub追问谢谢高手啊
全部回答
- 1楼网友:掌灯师
- 2021-03-31 11:29
Private Sub Form_Load()
Show
Dim a%(3), i%, j%, t%
For i = 0 To 3
a(i) = InputBox("Please input 4 numbers:")
Next
For i = 1 To 3
For j = 0 To 3 - i
If a(j) > a(j + 1) Then
t = a(j)
a(j) = a(j + 1)
a(j + 1) = t
End If
Next j, i
Print "The sorted numbers:";
For i = 0 To 3
Print a(i);
Next
End Sub
Show
Dim a%(3), i%, j%, t%
For i = 0 To 3
a(i) = InputBox("Please input 4 numbers:")
Next
For i = 1 To 3
For j = 0 To 3 - i
If a(j) > a(j + 1) Then
t = a(j)
a(j) = a(j + 1)
a(j + 1) = t
End If
Next j, i
Print "The sorted numbers:";
For i = 0 To 3
Print a(i);
Next
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯