标题:一个判断两个数是否相等的问题!
取消只看楼主
b31b6b82
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-10-5
 问题点数:0 回复次数:0 
一个判断两个数是否相等的问题!
Private Sub Command1_Click()
Dim a1 As Single
Dim i As Single
Dim b As String
Dim b1 As String
Dim b2 As String
Dim x As String

'初始化
b = ""
b1 = ""
b2 = ""

For i = 0 To 5 '循环6次,每次生成一个随即数
11:
a1 = Int((33 * Rnd) + 1)
b1 = a1

If StrComp(b1, b2, 0) = 0 Then '判断随机数不能相同
    GoTo 11
Else
    x = b1
End If


b2 = a1

Me.a(i).Text = x
Next


End Sub

我想生成6个随机数,已经实现了,另一个要求是这6个数不能重复,现在总是出现两个数重复,请大家帮忙看看,谢谢啊
搜索更多相关主题的帖子: 随机数 相等 StringDim 判断 Sub 
2008-08-03 23:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-226680-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.119153 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved