发布网友 发布时间:2022-04-23 02:47
共5个回答
热心网友 时间:2023-05-04 22:19
for循环只能嵌套不能交叉,所以三个next的顺序应该是
next c
next b
next a
或者干脆省略next后的变量名,vb自己知道应该对应哪个
热心网友 时间:2023-05-04 22:19
循环应该是这样
For a = 0 To 20
For b = 0 To 33
For c = 0 To 100
...
Next c
Next b
Next a
热心网友 时间:2023-05-04 22:20
Next a
Next b
Next c
顺序写反了,应该
Next c
Next b
Next a
热心网友 时间:2023-05-04 22:20
next c,b,a
或者你next next next也行
热心网友 时间:2023-05-04 22:21
Private Sub Command1_Click()
Dim a, b, c, d, e, f, n As Integer
n = 0
For a = 0 To 20
For b = 0 To 33
For c = 0 To 100
d = a * 5
e = b * 3
f = c / 3
If a + b + c = 100 And c Mod 3 = 0 And d + e + f = 100 Then
n = n + 1
Text1.Text = Str(n)
End If
Next c
Next b
Next a
End Sub