VB编程,急急急急急急急急急急急急急!!!!!!!!!!!!!!

小学生做加减乘除法的算术练习程序。计算机连续地随机给出两位数的加减乘除法算术题,要求学生回答,答对的打“√”,答错的“ד。将做过的题目存放在列表中备查,并随时给出答题的正确率。
最好6月16号一天内解决,明天勉强,后天作废

下面的代码另存为Form1.frm
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8985
ClientLeft = 60
ClientTop = 345
ClientWidth = 10830
LinkTopic = "Form1"
ScaleHeight = 8985
ScaleWidth = 10830
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "提交"
Height = 615
Left = 6960
TabIndex = 6
Top = 3840
Width = 2055
End
Begin VB.TextBox Text1
Height = 1215
Left = 7320
TabIndex = 5
Top = 2160
Width = 1575
End
Begin VB.Label Label14
Height = 495
Left = 9240
TabIndex = 15
Top = 1080
Width = 1455
End
Begin VB.Label Label13
Caption = "正确率为:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 7080
TabIndex = 14
Top = 1080
Width = 1815
End
Begin VB.Label Label6
Height = 3015
Left = 1200
TabIndex = 13
Top = 5760
Width = 8535
End
Begin VB.Label Label12
Caption = "答题记录"
Height = 495
Left = 1200
TabIndex = 12
Top = 4560
Width = 2055
End
Begin VB.Label Label11
Caption = "题"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 405
Left = 5640
TabIndex = 11
Top = 1080
Width = 855
End
Begin VB.Label Label10
Caption = "0"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 405
Left = 4800
TabIndex = 10
Top = 1080
Width = 615
End
Begin VB.Label Label9
Caption = "题,已做对:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 405
Left = 2760
TabIndex = 9
Top = 1080
Width = 1815
End
Begin VB.Label Label8
Caption = "1"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 405
Left = 2040
TabIndex = 8
Top = 1080
Width = 495
End
Begin VB.Label Label7
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 1215
Left = 9360
TabIndex = 7
Top = 2160
Width = 1215
End
Begin VB.Label Label5
Caption = "="
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 5880
TabIndex = 4
Top = 2160
Width = 975
End
Begin VB.Label Label4
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 4080
TabIndex = 3
Top = 2160
Width = 1335
End
Begin VB.Label Label3
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 2520
TabIndex = 2
Top = 2160
Width = 1215
End
Begin VB.Label Label2
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 840
TabIndex = 1
Top = 2160
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "当前第:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 400
Left = 720
TabIndex = 0
Top = 1080
Width = 2295
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim m As Integer, n As Integer, f As Integer

Private Sub Command2_Click()
If Command2.Caption = "提交" Then
If Text1.Text = "" Then
MsgBox "请回答!"
Else
If f = 1 Then
If CInt(Label2.Caption) + CInt(Label4.Caption) = CInt(Text1.Text) Then
Label7.Caption = "√"
m = m + 1
Else
Label7.Caption = "×"
End If

ElseIf f = 2 Then
If CInt(Label2.Caption) - CInt(Label4.Caption) = CInt(Text1.Text) Then
Label7.Caption = "√"
m = m + 1
Else
Label7.Caption = "×"
End If
ElseIf f = 3 Then
If CInt(Label2.Caption) * CInt(Label4.Caption) = CLng(Text1.Text) Then
Label7.Caption = "√"
m = m + 1
Else
Label7.Caption = "×"
End If
ElseIf f = 4 Then
If CInt(Label2.Caption) / CInt(Label4.Caption) = CInt(Text1.Text) Then
Label7.Caption = "√"
m = m + 1
Else
Label7.Caption = "×"
End If

End If
Command2.Caption = "下一题"
n = n + 1
Dim jilu As String
jilu = Label2.Caption & Label3.Caption & Label4.Caption & "=" & Text1.Text & Label7.Caption & Chr(13) + Chr(10)
Label6.Caption = Label6.Caption & jilu
End If

ElseIf Command2.Caption = "下一题" Then
Call Form_Load
Command2.Caption = "提交"
Label7.Caption = ""
Text1.Text = ""
Text1.SetFocus

End If

End Sub

Private Sub Form_Load()
Dim a, b, c As Integer
Randomize
a = CInt(Rnd() * 90 + 10)
b = CInt(Rnd() * 90 + 10)
f = Int(Rnd() * 4) + 1
If f = 1 Then
Label3.Caption = "+"
ElseIf f = 2 Then
Label3.Caption = "-"
If a < b Then c = a: a = b: b = c
ElseIf f = 3 Then
Label3.Caption = "*"
ElseIf f = 4 Then
Label3.Caption = "/"
While a Mod b <> 0
b = CInt(Rnd() * 90 + 10)
Wend
End If
Label2.Caption = a
Label4.Caption = b

Label8.Caption = n + 1
Label10.Caption = m
If n > 0 Then Label13.Caption = Format(m / n, "0.00%")

End Sub
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-06-16
'Command1,List1保存题目,Label1出题,Label2显示对错
'Label3显示正确率,Text1输入结果,按回车出下一道题
Option Explicit
Dim X1 As Integer, X2 As Integer '两个数
Dim X3 As Integer '运算符
Dim X4 As Double '结果
Dim intAll As Integer, intRight As Integer
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Command1.Caption = "重做"
Else
Command1.Caption = "开始"
End If
intAll = 0
intRight = 0
initTxt
Label2.Caption = ""
Label3.Caption = ""
List1.Clear
End Sub

Private Sub Form_Load()
Text1.Text = ""
Command1.Caption = "开始"
Label1.Caption = "点击“开始”出题"
Label2.Caption = ""
Label3.Caption = ""
End Sub

Private Sub initTxt()
Dim str1 As String
Randomize
X1 = Int((90 * Rnd) + 10)
X2 = Int((90 * Rnd) + 10)
X3 = Int((4 * Rnd) + 1)
Text1.Text = ""
Text1.SetFocus
intAll = intAll + 1
Select Case X3
Case 1
str1 = "+"
X4 = X1 + X2
Case 2
str1 = "-"
If X1 < X2 Then
X4 = X1: X1 = X2: X2 = X4
End If
X4 = X1 - X2
Case 3
str1 = "*"
X4 = X1 * X2
Case 4
str1 = "/"
X4 = Round(X1 / X2, 3)
'除法的小数位数比较难把握,暂定3位
End Select
Label1.Caption = X1 & str1 & X2 & "="

End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If X4 = Round(Val(Text1.Text), 3) Then
Label2.Caption = "√"
intRight = intRight + 1
Else
Label2.Caption = "×"
End If
Label3.Caption = "出题" & intAll & "道," & "正确" & intRight & _
"道,正确率" & Format(intRight / intAll, "0.00%")
List1.AddItem Label1.Caption & Text1.Text & "," & Label2.Caption, 0
initTxt
ElseIf (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 46 Then '数字、退格、小数点
KeyAscii = 0
End If
End Sub

Private Sub Timer1_Timer()
lngTime = lngTime - 1
Label3.Caption = "剩余时间:" & lngTime & "秒"
If lngTime = 0 Then
Command1.Caption = "继续"
Command1.Enabled = True
Timer1.Enabled = False
Text1.Text = ""
Text2.Text = ""
Text1.Text = ""
Label2.Caption = ""
Open App.Path & "\test.txt" For Append As #1
Print #1, Label3.Caption
Close
End If
End Sub本回答被提问者采纳
第2个回答  2011-06-16
我有类似现成的程序,是我给孩子编的,你给个邮箱,给你发过去.
第3个回答  2011-06-16
算了吧

用VB如何编写这个题的代码??急用,求助!!!
1. 创建一个新的Windows应用程序项目。在VB.NET 中,选择“文件” > “新建项目”,然后选择“Windows Forms 应用程序”模板。2. 在主窗体上添加三个 ComboBox 控件,分别用于选择三种货物。在属性窗口中,将每个 ComboBox 的“Items”属性设置为货物名称列表,例如“苹果”、“香蕉”和“橙子”。设...

VB程序问题,急急急,求助!
1、提供界面让用户输入,只要一对文本框输入坐标,采用多次输入的方式(每次输入一个点)。在两个文本框输入坐标(x,y)后点击“添加”按钮,保存该坐标,如此循环录入即可。最好用一个标签提示当前已经输入的坐标。可以用二维数组保存所有已经输入的坐标(当然因为个数不确定,用集合Collection更好)。至于...

急求VB编程代码!!!
Private Sub Command1_Click() Cls Randomize Dim MatrixA() As Integer, MatrixB() As Integer, Order Dim i As Integer, j As Integer Order = InputBox("请输入方阵的阶数N:", "矩阵运算", 5) If Order < 1 Or Not IsNumeric(Order) Then MsgBox "数据错误!", 16 El...

VB 编成问题。急!
1、end 是完全结束程序进程,STOP是中断,进程未退出 2、Private Sub command1_Click()Dim TextLine Open "TESTFILE" For Input As #1 ' 打开文件。Do While Not EOF(1) ' 循环至文件尾。Line Input #1, A ' 读入第一个值到A Line Input #1, B ' 读入第二个值到B Line Inpu...

急急急!用VB编程求解线性方程组,用高斯消去法
Sub 解方程(XiSu() As Double, Jie() As Double)Dim BeiSu As Double On Error GoTo err1 m = UBound(XiSu, 1) '行数 n = UBound(XiSu, 2) '列数 If n <> m + 1 Then MsgBox "系数矩阵维数不正确!", , "注意"Exit Sub End If For i = 0 To m If XiSu(i, i) ...

VB代码,高手进,急啊!知道的快,赶时间
Private Function jc(ByVal n)If n = 0 Then jc = 1 If n > 0 Then jc = jc(n - 1) * n End Function Private Sub Command1_Click()n = Val(Text1.Text)For i = 1 To n s = s + jc(i)Next Text2.Text = s End Sub ...

急急急!求下面这道题的VB代码,最好附上效果运行图。万分感谢。_百度知 ...
Private Sub Command1_Click() x = Val(Text1.Text) If x < 0 Then y = x If x = 0 Then y = "未定义" If x > 0 And x <= 10 Then y = x ^ 2 If x > 10 And x <= 20 Then y = 10 If x > 20 And x <= 40 Then y = 0.5 * x + 20 If x ...

初学者求该VB式的计算步骤,不长2行,急急急急急急急
i的初值是1,步长是2,则在整个循环过程中i的变化过程是1、3、5、7、9、11,当i=11时因为已超过循环终值10,所以跳出循环,这时候i的值就是11

用vb做!急急急
Dim i As Integer Dim j As integer Dim n As Integer Dim x As Integer Dim A As double Dim B As double Dim Y As double x=2 n=10 Y=0 For i=1 To n A=1 For j=1 To 4*i+1 A=A*x Next B=1 For j=1 To 4*i+1 B=B*j Next Y=Y+A\/B Next MsgBox CStr(Y)E...

大虾们,紧急求助!关于VB编程,编写代码
a=10 b=a c=b+a d=b+c ...(写个150多行)xc=xa+xb print xc

相似回答