VB编程中的循环问题
PrivateSubCommand1_Click()DimAAsIntegerDimBAsIntegerDimCAsIntegerDimDAsIntegerDimEAsI...
Private Sub Command1_Click()
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
A = 1
B = 2
C = 6
D = 7
For A = 1 To 4
For B = 2 To 10
For C = 6 To 10
For D = 7 To 10
E = A + B + C + D
If E = 22 And A < B And B < C And C < D Then
Text1.Text = Str(A) + Str(B) + Str(C) + Str(D)
Else
End If
Next D
Next C
Next B
Next A
End Sub
想实现在文本框中输出A+B+C+D=22 的所有组合,可是运行结果却仅是一个4 5 6 7
盼高手赐教,错在哪里?如何能实现把和为22的组合全部列出? 展开
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
A = 1
B = 2
C = 6
D = 7
For A = 1 To 4
For B = 2 To 10
For C = 6 To 10
For D = 7 To 10
E = A + B + C + D
If E = 22 And A < B And B < C And C < D Then
Text1.Text = Str(A) + Str(B) + Str(C) + Str(D)
Else
End If
Next D
Next C
Next B
Next A
End Sub
想实现在文本框中输出A+B+C+D=22 的所有组合,可是运行结果却仅是一个4 5 6 7
盼高手赐教,错在哪里?如何能实现把和为22的组合全部列出? 展开
1个回答
展开全部
2个timer 就行了,想怎么做就怎么做 再问得清楚点吧,下面是可能你要的回答 Private Sub Timer1_Timer() '这里加你要的代码 ,然后下一次就是执行timer2中的 Timer1.Enabled = False Timer2.Enabled = True End Sub Private Sub Timer2_Timer() '这里加你要的代码 ,然后下一次就是执行timer1中的 Timer2.Enabled = False Timer1.Enabled = True End Sub
追问
怎么还有timer控件,能说的详细吗?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询