用VB做打字游戏~代码~急求~~~~~~~~

代码啊~越快越好~~~程序也要~快~还有~最好发到我的邮箱~chiyuxiao1997@163.com... 代码啊~越快越好~~~
程序也要~快~
还有~最好发到我的邮箱~
chiyuxiao1997@163.com
展开
 我来答
百度网友b77483209
2008-07-08
知道答主
回答量:3
采纳率:0%
帮助的人:0
展开全部
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
发你邮箱了
hxf0663
2008-06-29 · TA获得超过909个赞
知道小有建树答主
回答量:1374
采纳率:0%
帮助的人:980万
展开全部
'系原创:
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
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友1eb8ff4
2008-06-29 · TA获得超过1.6万个赞
知道大有可为答主
回答量:4368
采纳率:33%
帮助的人:3462万
展开全部
找到了!!

参考资料: http://download.csdn.net/source/371211

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式