关于VB中从 1到35随即产生5个数,要求有些数不能同同时出现的问题,写完后每次都是运算卡死,如1 不与3,4,5,6,7,8,16,18,19,21,23,25,26,27,31,32,33,35 同时间出现2 不与3,4,5,6,7,9,11,12,14,15,16,18,19,20,21,22,24,25
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 01:24:34
关于VB中从 1到35随即产生5个数,要求有些数不能同同时出现的问题,写完后每次都是运算卡死,如1 不与3,4,5,6,7,8,16,18,19,21,23,25,26,27,31,32,33,35 同时间出现2 不与3,4,5,6,7,9,11,12,14,15,16,18,19,20,21,22,24,25
关于VB中从 1到35随即产生5个数,要求有些数不能同同时出现的问题,写完后每次都是运算卡死,
如1 不与3,4,5,6,7,8,16,18,19,21,23,25,26,27,31,32,33,35 同时间出现
2 不与3,4,5,6,7,9,11,12,14,15,16,18,19,20,21,22,24,25,26,27,29,30,31,32,34同时出现
3不与5、8、10、11、12、14、16、21、22、23、、25、26、31、34、35 同时出现
kaishi:
Randomize
t35(0) = Int(Rnd() * 35 + 1)
t35(1) = Int(Rnd() * 35 + 1)
t35(2) = Int(Rnd() * 35 + 1)
t35(3) = Int(Rnd() * 35 + 1)
t35(4) = Int(Rnd() * 35 + 1)
haoma = t35(0) & "," & t35(1) & "," & t35(2) & "," & t35(3) & "," & t35(4)
Do While InStr(haoma,1) > 0
If InStr(haoma,3) > 0 Or InStr(haoma,4) > 0 Or InStr(haoma,5) > 0 Or InStr(haoma,6) > 0 Or InStr(haoma,7) > 0 Or InStr(haoma,8) > 0 Or InStr(haoma,16) > 0 Or InStr(haoma,18) > 0 Or InStr(haoma,19) > 0 Or InStr(haoma,21) > 0 Or InStr(haoma,23) > 0 Or InStr(haoma,25) > 0 Or InStr(haoma,26) > 0 Or InStr(haoma,27) > 0 Or InStr(haoma,31) > 0 Or InStr(haoma,33) > 0 Or InStr(haoma,35) > 0 Then
GoTo kaishi
End If
Loop
'1 不与3,4,5,6,7,8,16,18,19,21,23,25,26,27,31,32,33,35 同时间出现
Text2.Text = Text2.Text & haoma
Text2.Text = Text2.Text & vbCrLf
End Sub
关于VB中从 1到35随即产生5个数,要求有些数不能同同时出现的问题,写完后每次都是运算卡死,如1 不与3,4,5,6,7,8,16,18,19,21,23,25,26,27,31,32,33,35 同时间出现2 不与3,4,5,6,7,9,11,12,14,15,16,18,19,20,21,22,24,25
把你的代码放出来看看