主题:一个出数学加减题的程序【新】
孙瑞
[专家分:590] 发布于 2007-07-16 22:24:00
修正了程序的乘除错误!基本无错!
恳请高手指正代码!
谢谢!
[b]欢迎查错!![/b]
[b]sunruiyeyipeng@163.com[/b]
[url=http://sunrui.123ye.com]我的网站[/url]
[fly]Help Me![/fly]
最后更新于:2007-09-07 22:02:00
回复列表 (共23个回复)
11 楼
loongchina [专家分:90] 发布于 2007-07-18 17:31:00
你那修改后的程序,还没解决我所提的问题啊
12 楼
loongchina [专家分:90] 发布于 2007-07-18 17:36:00
你修改后的程序还没有没有改掉我所提的问题啊,你只是做了个,用户名而已啊
13 楼
孙瑞 [专家分:590] 发布于 2007-07-18 17:39:00
100个不做完就想退出肯定不行!!
这也是为了管住我弟弟!
作为程序来讲,你们可以修改嘛!
这是开放版权的!
14 楼
孙瑞 [专家分:590] 发布于 2007-07-19 17:44:00
Dim see1 As String
Dim idc As Long
Dim isd As String
Dim iis(100) As String
Dim se1, se2 As String
Dim asw As Long
Dim goi As Boolean
Dim typename, pathe As String
Dim kl As Long
Dim l As String
Dim pathee As String
'确认在清除一个病毒后隐藏,在又发现病毒时出现
Dim showmea As Boolean
Dim showme As Boolean
Private Sub Check2_Click()
If Check2.Value = 1 Then
showmea = False
ElseIf Check2.Value = 0 Then
showmea = True
End If
End Sub
Private Sub Chose_Timer()
If Option1.Value = True And goi Then
Kill isd
goi = False
showme = False
showmea = True
ElseIf Option2.Value = True And goi Then
List1.AddItem "用户取消删除!"
ElseIf Option2.Value = True And Not goi Then
Option2.Value = False
End If
End Sub
Private Sub Command5_Click()
List1.Clear
End Sub
Private Sub Form_Initialize()
Check1.Value = 1
Check2.Value = 1
End Sub
Private Sub Command1_Click()
aa% = InStrRev(isd, "\")
pathee = Mid(isd, 1, aa)
Shell "Explorer.exe ," & pathee, vbNormalFocus
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
se1 = "on"
se2 = "hide"
Open see1 & "\control.txt" For Output As #1
Write #1, se1
Write #1, se2
Close #1
End Sub
Private Sub Command4_Click()
Form2.Show
End Sub
16 楼
bcahzvip [专家分:6040] 发布于 2007-07-21 04:06:00
开不开放版权,这里很多人都能自己花10分钟做出来的.
只不过.做了对他们来说也没多大用处.
做出适用于自己的程序没什么不好!~
17 楼
孙瑞 [专家分:590] 发布于 2007-07-24 18:09:00
求求大家了!!
我也不知道漏洞在那里!
18 楼
孙瑞 [专家分:590] 发布于 2007-08-25 17:52:00
无法找出除法运算出错(即类似于“8/2=0”的错误)的原因,请高手指点!
19 楼
btxdlibin [专家分:2430] 发布于 2007-08-26 11:13:00
'代码冗长,格式不规范.多改进!
Dim daan(100) As Long
Dim shuzi1&, shuzi2 As Long '定义变量方式要注意
Dim sdp As Long
Dim scro1&, scro2 As Long
Dim pldid As Long
Dim does(100) As Long
Dim kaishi As Boolean
Dim chen As Integer
Dim user As String
Private Sub Combo1_Click()
chen = 10 ^ (Combo1.ListIndex + 1) '这里帮你改了下
End Sub
Private Sub Command1_Click()
Dim wr1$, wr2 As String
Dim textfor As String
Dim Lth As Integer
Lth = Len(Str(chen)) - 1
Combo1.Enabled = False
kaishi = True
List1.Clear
For chu! = 1 To 25
'*准备题目数据
'取数据
shuzi1 = Int(Rnd(6) * chen)
shuzi2 = Int(Rnd(6) * chen)
wr1 = Trim(Str(shuzi1))
wr2 = Trim(Str(shuzi2))
textfor = Space(Lth - Len(wr1)) & wr1 & "+" & wr2 & Space(Lth - Len(wr2)) & "="
daan(chu) = shuzi1 + shuzi2
List1.AddItem textfor
'删除数据,准备再用
Next chu
For chu = 26 To 50
shuzi1 = Int(Rnd(6) * chen)
shuzi2 = Int(Rnd(6) * chen)
wr1 = Trim(Str(shuzi1))
wr2 = Trim(Str(shuzi2))
If shuzi1 < shuzi2 Then
textfor = Space(Lth - Len(wr2)) & wr2 & "-" & wr1 & Space(Lth - Len(wr1)) & "="
'timu(chu) = textfor
Else
textfor = Space(Lth - Len(wr1)) & wr1 & "-" & wr2 & Space(Lth - Len(wr2)) & "="
'make it useless
End If
daan(chu) = IIf(shuzi1 < shuzi2, shuzi2 - shuzi1, shuzi1 - shuzi2)
List1.AddItem textfor
shuzi1 = 0
shuzi2 = 0
textfor = ""
Next chu
'*************************
'乘法
For chu = 51 To 75
shuzi1 = Int(Rnd(6) * chen) + 1 '为什么不直接用这句????
shuzi2 = Int(Rnd(6) * chen) + 1
wr1 = Trim(Str(shuzi1))
wr2 = Trim(Str(shuzi2))
textfor = Space(Lth - Len(wr2)) & wr2 & "×" & wr1 & Space(Lth - Len(wr1)) & "="
List1.AddItem textfor
daan(chu) = shuzi2 * shuzi1
shuzi1 = 0
shuzi2 = 0
textfor = ""
Next chu
'除法
For chu = 76 To 100
'↓↓↓↓↓↓↓↓↓↓↓完全重复的一段代码↓↓↓↓↓↓↓↓↓
shuzi1 = Int(Rnd(6) * chen) + 1
shuzi2 = Int(Rnd(6) * chen) + 1
If shuzi1 > shuzi2 And (Int(shuzi1 / shuzi2) = shuzi1 / shuzi2) Then
wr1 = Trim(Str(shuzi1))
wr2 = Trim(Str(shuzi2))
textfor = Space(Lth - Len(wr1)) & wr1 & "÷" & wr2 & Space(Lth - Len(wr2)) & "="
daan(chu) = shuzi1 / shuzi2 '改错 这就是你除法错的地方
List1.AddItem textfor
Else
'↑↑↑↑↑↑↑↑↑↑↑完全重复的一段代码↑↑↑↑↑↑↑↑
wem:
shuzi1 = Int(Rnd(6) * chen) + 1
shuzi2 = Int(Rnd(6) * chen) + 1
If shuzi1 < shuzi2 Or Int(shuzi1 / shuzi2) <> shuzi1 / shuzi2 Then GoTo wem
'''''''''''''''''''''''''''''''
wr1 = Trim(Str(shuzi1))
wr2 = Trim(Str(shuzi2))
textfor = Space(Lth - Len(wr1)) & wr1 & "÷" & wr2 & Space(Lth - Len(wr2)) & "="
daan(chu) = shuzi1 / shuzi2
List1.AddItem textfor
shuzi1 = 0
shuzi2 = 0
textfor = ""
End If ''''''''
Next chu
List1.ListIndex = 0
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
user = InputBox("请输入您的姓名:", "输入框", "利多")
chen = 10
kaishi = False
Randomize
Label1.Caption = "请点击“出题”键出题!"
End Sub
Private Sub List1_Click()
'***检查做过了没有******
If does(List1.ListIndex + 1) <> 1 Then
'****************************
Label1.Caption = List1.Text
sdp = List1.ListIndex + 1
Text1.SetFocus
Else
Label1.Caption = "这道题你已经做过了!!"
End If
End Sub
20 楼
btxdlibin [专家分:2430] 发布于 2007-08-26 11:13:00
Private Sub Text1_KeyPress(KeyAscii As Integer)
On Error Resume Next
If does(List1.ListIndex + 1) <> 1 Then
'****************************
sdp = List1.ListIndex + 1
If KeyAscii = 13 Then
'判断有没有,及答案是否正确
If Not IsNumeric(Text1) Then
Text1.Text = ""
List2.AddItem "请输入数字!!!!"
Else
If Val(Text1.Text) = daan(sdp) Then
List1.List(sdp - 1) = List1.Text & daan(sdp) & Space(17 - Len(Str(chen)) * 2 - Len(Text1)) & "恭喜,回答正确!"
scro1 = scro1 + 1
does(sdp) = 1
pldid = pldid + 1
If List1.ListCount = List1.ListIndex + 1 Then
Exit Sub
Else
List1.ListIndex = List1.ListIndex + 1
End If
Else
'List1的Length要再大点,否则万位乘法显示不了答案
List1.List(sdp - 1) = List1.Text & Text1.Text & Space(17 - Len(Str(chen)) * 2 - Len(Text1)) & "抱歉,回答错误!正确答案:" & daan(sdp)
does(sdp) = 1
pldid = pldid + 1
scro2 = scro2 + 1
If List1.ListCount = List1.ListIndex + 1 Then
Exit Sub
Else
List1.ListIndex = List1.ListIndex + 1
End If
End If
Text1.Text = ""
End If
End If
Else
Label1.Caption = "该题已作!"
Text1.Text = ""
End If
keylast = 0
End Sub
Private Sub Timer1_Timer()
If pldid = 100 Then
zql = IIf(scro1 = 0, 0, scro2) '??
Timer1.Interval = 0
MsgBox "完成题目!" & vbCrLf & "正确:" & scro1 & vbCrLf & "错误:" & scro2, vbInformation
stBar.Panels(1).Text = "等待状态……"
Load Form2
'''''''''''''''Form2显示移到这里了
Dim says$(10)
says(1) = user
says(2) = vbCrLf & " 经过我们的测试,我们给出以下的意见:" & vbCrLf
'*********
If scro1 > 90 Then
says(3) = "不错呀!这次成绩不错!!"
ElseIf scro1 > 80 And scro2 <= 90 Then
says(3) = "还可以!这次成绩将就!"
ElseIf scro1 > 60 And scro1 <= 80 Then
says(3) = "天哪!你要好好努力呀!!"
ElseIf scro1 <= 50 Then
says(3) = "好好反省!!为什么会这样!!"
End If
'*********************
says(4) = vbCrLf & " 最后感谢使用我们的软件!!!"
Form2.Show
For kl = 1 To 4
Form2!Label1.Caption = Form2!Label1.Caption & says(kl)
Next kl
''''''''''''''''
End If
'**总是有**
If kaishi Then
Form1.Caption = "做题中……(" & pldid & "/100)"
stBar.Panels(1).Text = "做题中……(" & pldid & "/100)"
Else
Form1.Caption = "数学学习习题集——记炫题"
End If
End Sub
我来回复