标题:一年级加减法训练怎么改?
只看楼主
rose998
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2010-3-27
结帖率:100%
已结贴  问题点数:20 回复次数:5 
一年级加减法训练怎么改?
Private Sub Command1_Click()

Text1(0) = Int(Rnd() * 20)
Text1(1) = Int(Rnd() * 20)
Text1(3) = Int(Rnd() * 20)
Text1(4) = Int(Rnd() * 20)
Text1(7) = Int(Rnd() * 20)
Text1(8) = Int(Rnd() * 20)
If Val(Text1(0)) > Val(Text1(1)) Then
Label1 = "-"
Else
Label1 = "+"
End If
If Val(Text1(3)) > Val(Text1(4)) Then
Label6 = "-"
Else
Label6 = "+"
End If
If Val(Text1(8)) > Val(Text1(7)) Then
Label7 = "-"
Else
Label7 = "+"
End If

Text1(2) = ""
Text1(5) = ""
Text1(6) = ""
Label3 = ""
Label4 = ""
Label9 = ""
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
If Text1(0) > Text1(1) Then
   If Val(Text1(2)) = Val(Text1(0)) - Val(Text1(1)) Then
     Label3 = "√"
   Else
     Label3 = "×"
   End If
Else
   
     If Val(Text1(2)) = Val(Text1(0)) + Val(Text1(1)) Then
       Label3 = "√"
     Else
     Label3 = "×"
     End If
 End If

If Text1(3) > Text1(4) Then
   If Val(Text1(5)) = Val(Text1(3)) - Val(Text1(4)) Then
     Label4 = "√"
   Else
     Label4 = "×"
   End If
Else
   
     If Val(Text1(5)) = Val(Text1(3)) + Val(Text1(4)) Then
       Label4 = "√"
     Else
     Label4 = "×"
     End If
 End If

If Text1(8) > Text1(7) Then
   If Val(Text1(6)) = Val(Text1(8)) - Val(Text1(7)) Then
     Label9 = "√"
   Else
     Label9 = "×"
   End If
Else
   
     If Val(Text1(6)) = Val(Text1(8)) + Val(Text1(7)) Then
       Label9 = "√"
     Else
     Label9 = "×"
     End If
 End If



End Sub
执行起来有问题,但又不知道错在哪儿?请大家帮忙看下,谢谢!!


[ 本帖最后由 rose998 于 2010-3-28 15:00 编辑 ]
搜索更多相关主题的帖子: 加减法 训练 
2010-03-28 14:48
小靓仔仔
Rank: 1
等 级:新手上路
帖 子:17
专家分:3
注 册:2010-3-7
得分:0 
具体是什么问题呢?
2010-03-28 17:40
lucky563591
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:4
帖 子:765
专家分:2103
注 册:2009-11-18
得分:0 
I don not know
2010-03-28 17:54
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4912
专家分:29900
注 册:2008-10-15
得分:20 
每组判断时类型错误,我只注释了中间一个.你自己看一下.

程序代码:
Private Sub Command3_Click()
If Val(Text1(0)) > Val(Text1(1)) Then
   If Val(Text1(2)) = Val(Text1(0)) - Val(Text1(1)) Then
     Label3 = ""
   Else
     Label3 = "×"
   End If
Else
  
     If Val(Text1(2)) = Val(Text1(0)) + Val(Text1(1)) Then
       Label3 = ""
     Else
     Label3 = "×"
     End If
End If

If Val(Text1(3)) > Val(Text1(4)) Then                           'textbox 默认是 文本,比较也是文本比较,所以 "11"<"5"
   If Val(Text1(5)) = Val(Text1(3)) - Val(Text1(4)) Then
     Label4 = ""
   Else
     Label4 = "×"
   End If
Else
  
     If Val(Text1(5)) = Val(Text1(3)) + Val(Text1(4)) Then
       Label4 = ""
     Else
     Label4 = "×"
     End If
End If

If Val(Text1(8)) > Val(Text1(7)) Then
   If Val(Text1(6)) = Val(Text1(8)) - Val(Text1(7)) Then
     Label9 = ""
   Else
     Label9 = "×"
   End If
Else
     If Val(Text1(6)) = Val(Text1(8)) + Val(Text1(7)) Then
       Label9 = ""
     Else
     Label9 = "×"
     End If
End If


授人于鱼,不如授人于渔
早已停用QQ了
2010-03-29 00:06
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4912
专家分:29900
注 册:2008-10-15
得分:0 
还有,大量控件的程序,请发工程,不要光发一个代码,

为了调试你这些代码,控件都画了N个,排了N回,才排对你的样子来.

授人于鱼,不如授人于渔
早已停用QQ了
2010-03-29 00:07
rose998
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2010-3-27
得分:0 
谢谢版主风吹过b,你说的很对,按你的提示,改过来后就对了!~
2010-03-29 15:57



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




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

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