用VB做打字游戏~代码~急求~~~~~~~~
代码啊~越快越好~~~程序也要~快~还有~最好发到我的邮箱~chiyuxiao1997@163.com...
代码啊~越快越好~~~
程序也要~快~
还有~最好发到我的邮箱~
chiyuxiao1997@163.com 展开
程序也要~快~
还有~最好发到我的邮箱~
chiyuxiao1997@163.com 展开
3个回答
展开全部
Dim t As Integer
Dim s(1 To 5, 1 To 5) As String '用二维数组s()来存放打字数据
Dim n As Integer
Dim r As Integer
Private Sub Command1_Click()
If t = 0 Then
MsgBox "请先选择好打字选项", vbCritical + vbOKOnly + vbDefaultButton1, "提示"
Else
Label1.Caption = ""
Command1.Enabled = False
If t = 1 Then
Call producenumsigh
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 2 Then
Call produceu
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 3 Then
Call producel
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 4 Then
Call producem
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 5 Then
Call producemix
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
End If
Timer1.Enabled = True
End If
'以上是根据用户选的打字选项分别调用对应的过程来产生打字数据
Text1.SetFocus
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Label1.Caption = "欢迎使用打字练习程序"
End Sub
Private Sub l_Click()
t = 3
End Sub
Private Sub m_Click()
t = 4
End Sub
Private Sub mix_Click()
t = 5
End Sub
Private Sub numsigh_Click()
t = 1
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) = 25 Then
Timer1.Enabled = False
For i = 1 To 25
If Mid(Text1.Text, i, 1) = Mid(Label1.Caption, i, 1) Then r = r + 1
Next
MsgBox "您的输入速度是:" & Int(25 / n) & "字符/秒" & vbCrLf & "您的正确率为:" & 4 * r & "%", vbInformation + vbOKOnly + vbDefaultButton1, "打字统计"
t = 0
Text1.Text = ""
Label1.Caption = ""
Command1.Enabled = True
Label1.Caption = "选择打字选项,按开始重新测试"
End If
End Sub
Private Sub Timer1_Timer()
n = n + 1 '统计打字的时间
End Sub
Private Sub u_Click()
t = 2
End Sub
Private Sub producenumsigh() '产生随机的数字字符并存放在数组s()中
Dim a%, b%, c%, d%, e%
For i = 1 To 5
Randomize
a = Int(Rnd * 15) + 33
b = Int(Rnd * 6) + 58 '根据键盘上的数字字符的Ascii码值,以下过程同
c = Int(Rnd * 5) + 91
d = Int(Rnd * 3) + 123
e = Int(Rnd * 9) + 48
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(c)
s(i, 4) = Chr(d)
s(i, 5) = Chr(e)
Next
End Sub
Private Sub produceu() Randomize
For i = 1 To 5
For j = 1 To 5
s(i, j) = Chr(Int(Rnd * 25) + 65)
Next j
Next i
End Sub
Private Sub producel()
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 25) + 97)
Next j
Next i
End Sub
Private Sub producem() '产生随机的大小写字母并存放在数组s()中
Dim a%, b%
For i = 1 To 5
Randomize
a = Int(Rnd * 25) + 65
b = Int(Rnd * 25) + 97
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(a)
s(i, 4) = Chr(b)
s(i, 5) = Chr(a)
Next i
End Sub
Private Sub producemix() '产生随机的数字、字符及大小写字母并存放在数组s()中
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 93) + 33)
Next j
Next i
End Sub
发你邮箱了
Dim s(1 To 5, 1 To 5) As String '用二维数组s()来存放打字数据
Dim n As Integer
Dim r As Integer
Private Sub Command1_Click()
If t = 0 Then
MsgBox "请先选择好打字选项", vbCritical + vbOKOnly + vbDefaultButton1, "提示"
Else
Label1.Caption = ""
Command1.Enabled = False
If t = 1 Then
Call producenumsigh
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 2 Then
Call produceu
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 3 Then
Call producel
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 4 Then
Call producem
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 5 Then
Call producemix
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
End If
Timer1.Enabled = True
End If
'以上是根据用户选的打字选项分别调用对应的过程来产生打字数据
Text1.SetFocus
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Label1.Caption = "欢迎使用打字练习程序"
End Sub
Private Sub l_Click()
t = 3
End Sub
Private Sub m_Click()
t = 4
End Sub
Private Sub mix_Click()
t = 5
End Sub
Private Sub numsigh_Click()
t = 1
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) = 25 Then
Timer1.Enabled = False
For i = 1 To 25
If Mid(Text1.Text, i, 1) = Mid(Label1.Caption, i, 1) Then r = r + 1
Next
MsgBox "您的输入速度是:" & Int(25 / n) & "字符/秒" & vbCrLf & "您的正确率为:" & 4 * r & "%", vbInformation + vbOKOnly + vbDefaultButton1, "打字统计"
t = 0
Text1.Text = ""
Label1.Caption = ""
Command1.Enabled = True
Label1.Caption = "选择打字选项,按开始重新测试"
End If
End Sub
Private Sub Timer1_Timer()
n = n + 1 '统计打字的时间
End Sub
Private Sub u_Click()
t = 2
End Sub
Private Sub producenumsigh() '产生随机的数字字符并存放在数组s()中
Dim a%, b%, c%, d%, e%
For i = 1 To 5
Randomize
a = Int(Rnd * 15) + 33
b = Int(Rnd * 6) + 58 '根据键盘上的数字字符的Ascii码值,以下过程同
c = Int(Rnd * 5) + 91
d = Int(Rnd * 3) + 123
e = Int(Rnd * 9) + 48
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(c)
s(i, 4) = Chr(d)
s(i, 5) = Chr(e)
Next
End Sub
Private Sub produceu() Randomize
For i = 1 To 5
For j = 1 To 5
s(i, j) = Chr(Int(Rnd * 25) + 65)
Next j
Next i
End Sub
Private Sub producel()
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 25) + 97)
Next j
Next i
End Sub
Private Sub producem() '产生随机的大小写字母并存放在数组s()中
Dim a%, b%
For i = 1 To 5
Randomize
a = Int(Rnd * 25) + 65
b = Int(Rnd * 25) + 97
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(a)
s(i, 4) = Chr(b)
s(i, 5) = Chr(a)
Next i
End Sub
Private Sub producemix() '产生随机的数字、字符及大小写字母并存放在数组s()中
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 93) + 33)
Next j
Next i
End Sub
发你邮箱了
展开全部
'系原创:
Dim t As Integer
Dim s(1 To 5, 1 To 5) As String '用二维数组s()来存放打字数据
Dim n As Integer
Dim r As Integer
Private Sub Command1_Click()
If t = 0 Then
MsgBox "请先选择好打字选项", vbCritical + vbOKOnly + vbDefaultButton1, "提示"
Else
Label1.Caption = ""
Command1.Enabled = False
If t = 1 Then
Call producenumsigh
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 2 Then
Call produceu
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 3 Then
Call producel
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 4 Then
Call producem
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 5 Then
Call producemix
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
End If
Timer1.Enabled = True
End If
'以上是根据用户选的打字选项分别调用对应的过程来产生打字数据
Text1.SetFocus
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Label1.Caption = "欢迎使用打字练习程序"
End Sub
Private Sub l_Click()
t = 3
End Sub
Private Sub m_Click()
t = 4
End Sub
Private Sub mix_Click()
t = 5
End Sub
Private Sub numsigh_Click()
t = 1
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) = 25 Then
Timer1.Enabled = False
For i = 1 To 25
If Mid(Text1.Text, i, 1) = Mid(Label1.Caption, i, 1) Then r = r + 1
Next
MsgBox "您的输入速度是:" & Int(25 / n) & "字符/秒" & vbCrLf & "您的正确率为:" & 4 * r & "%", vbInformation + vbOKOnly + vbDefaultButton1, "打字统计"
t = 0
Text1.Text = ""
Label1.Caption = ""
Command1.Enabled = True
Label1.Caption = "选择打字选项,按开始重新测试"
End If
End Sub
Private Sub Timer1_Timer()
n = n + 1 '统计打字的时间
End Sub
Private Sub u_Click()
t = 2
End Sub
Private Sub producenumsigh() '产生随机的数字字符并存放在数组s()中
Dim a%, b%, c%, d%, e%
For i = 1 To 5
Randomize
a = Int(Rnd * 15) + 33
b = Int(Rnd * 6) + 58 '根据键盘上的数字字符的Ascii码值,以下过程同
c = Int(Rnd * 5) + 91
d = Int(Rnd * 3) + 123
e = Int(Rnd * 9) + 48
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(c)
s(i, 4) = Chr(d)
s(i, 5) = Chr(e)
Next
End Sub
Private Sub produceu() '产生随机的大写字母并存放在数组s()中
Randomize
For i = 1 To 5
For j = 1 To 5
s(i, j) = Chr(Int(Rnd * 25) + 65)
Next j
Next i
End Sub
Private Sub producel() '产生随机的小写字母并存放在数组s()中
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 25) + 97)
Next j
Next i
End Sub
Private Sub producem() '产生随机的大小写字母并存放在数组s()中
Dim a%, b%
For i = 1 To 5
Randomize
a = Int(Rnd * 25) + 65
b = Int(Rnd * 25) + 97
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(a)
s(i, 4) = Chr(b)
s(i, 5) = Chr(a)
Next i
End Sub
Private Sub producemix() '产生随机的数字、字符及大小写字母并存放在数组s()中
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 93) + 33)
Next j
Next i
End Sub
Dim t As Integer
Dim s(1 To 5, 1 To 5) As String '用二维数组s()来存放打字数据
Dim n As Integer
Dim r As Integer
Private Sub Command1_Click()
If t = 0 Then
MsgBox "请先选择好打字选项", vbCritical + vbOKOnly + vbDefaultButton1, "提示"
Else
Label1.Caption = ""
Command1.Enabled = False
If t = 1 Then
Call producenumsigh
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 2 Then
Call produceu
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 3 Then
Call producel
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 4 Then
Call producem
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
ElseIf t = 5 Then
Call producemix
For i = 1 To 5
For j = 1 To 5
Label1.Caption = Label1.Caption + s(i, j)
Next j
Next i
End If
Timer1.Enabled = True
End If
'以上是根据用户选的打字选项分别调用对应的过程来产生打字数据
Text1.SetFocus
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Label1.Caption = "欢迎使用打字练习程序"
End Sub
Private Sub l_Click()
t = 3
End Sub
Private Sub m_Click()
t = 4
End Sub
Private Sub mix_Click()
t = 5
End Sub
Private Sub numsigh_Click()
t = 1
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) = 25 Then
Timer1.Enabled = False
For i = 1 To 25
If Mid(Text1.Text, i, 1) = Mid(Label1.Caption, i, 1) Then r = r + 1
Next
MsgBox "您的输入速度是:" & Int(25 / n) & "字符/秒" & vbCrLf & "您的正确率为:" & 4 * r & "%", vbInformation + vbOKOnly + vbDefaultButton1, "打字统计"
t = 0
Text1.Text = ""
Label1.Caption = ""
Command1.Enabled = True
Label1.Caption = "选择打字选项,按开始重新测试"
End If
End Sub
Private Sub Timer1_Timer()
n = n + 1 '统计打字的时间
End Sub
Private Sub u_Click()
t = 2
End Sub
Private Sub producenumsigh() '产生随机的数字字符并存放在数组s()中
Dim a%, b%, c%, d%, e%
For i = 1 To 5
Randomize
a = Int(Rnd * 15) + 33
b = Int(Rnd * 6) + 58 '根据键盘上的数字字符的Ascii码值,以下过程同
c = Int(Rnd * 5) + 91
d = Int(Rnd * 3) + 123
e = Int(Rnd * 9) + 48
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(c)
s(i, 4) = Chr(d)
s(i, 5) = Chr(e)
Next
End Sub
Private Sub produceu() '产生随机的大写字母并存放在数组s()中
Randomize
For i = 1 To 5
For j = 1 To 5
s(i, j) = Chr(Int(Rnd * 25) + 65)
Next j
Next i
End Sub
Private Sub producel() '产生随机的小写字母并存放在数组s()中
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 25) + 97)
Next j
Next i
End Sub
Private Sub producem() '产生随机的大小写字母并存放在数组s()中
Dim a%, b%
For i = 1 To 5
Randomize
a = Int(Rnd * 25) + 65
b = Int(Rnd * 25) + 97
s(i, 1) = Chr(a)
s(i, 2) = Chr(b)
s(i, 3) = Chr(a)
s(i, 4) = Chr(b)
s(i, 5) = Chr(a)
Next i
End Sub
Private Sub producemix() '产生随机的数字、字符及大小写字母并存放在数组s()中
For i = 1 To 5
For j = 1 To 5
Randomize
s(i, j) = Chr(Int(Rnd * 93) + 33)
Next j
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询