> 其他 >
一道vb题(懂的解) n=0 For i=1 To3 For j=5 To 1 step -1 n=n+1 Next j,i Print n; j; i
人气:279 ℃ 时间:2020-02-04 11:37:14
解答
如果按以下格式:
Private Sub Form_Load()
n = 0
For i = 1 To 3
For j = 5 To 1 Step -1
n = n + 1
Text3.Text = Text3.Text & vbCrLf & n & " - " & j & " - " & i
Next j
Next i
End Sub
结果是:n-j-i
1 - 5 - 1
2 - 4 - 1
3 - 3 - 1
4 - 2 - 1
5 - 1 - 1
6 - 5 - 2
7 - 4 - 2
8 - 3 - 2
9 - 2 - 2
10 - 1 - 2
11 - 5 - 3
12 - 4 - 3
13 - 3 - 3
14 - 2 - 3
15 - 1 - 3
如果按以下格式:
Private Sub Form_Load()
n = 0
For i = 1 To 3
For j = 5 To 1 Step -1
n = n + 1
Next j
Next i
Text3.Text = Text3.Text & vbCrLf & n & " - " & j & " - " & i
End Sub
结果是:n-j-i
15 - 0 - 4
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版