📄 计算机考试.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5835
ClientLeft = 60
ClientTop = 450
ClientWidth = 8670
LinkTopic = "Form1"
ScaleHeight = 5835
ScaleWidth = 8670
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 3615
Left = 2160
ScaleHeight = 3555
ScaleWidth = 3195
TabIndex = 4
Top = 1440
Width = 3255
End
Begin VB.TextBox txtInput
Height = 735
Left = 2880
TabIndex = 2
Top = 360
Width = 1455
End
Begin VB.CommandButton cmdMark
Caption = "计分"
BeginProperty Font
Name = "宋体-18030"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 6840
TabIndex = 1
Top = 360
Width = 1455
End
Begin VB.CommandButton cmdOk
BackColor = &H00000000&
Caption = "确定"
BeginProperty Font
Name = "宋体-18030"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 5040
TabIndex = 0
Top = 360
Width = 1455
End
Begin VB.Label lalExp
Caption = "Label1"
Height = 735
Left = 720
TabIndex = 3
Top = 360
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Num1 As Integer, Num2 As Integer '存放操作数
Dim SExp As String
Dim Result As Single '计算结果
Dim NOK As Integer, NError As Integer '统计计算正确与错误数
Private Sub Text1_Change()
End Sub
Private Sub cmdMark_Click()
Picture1.Print "------------------------------------"
Picture1.Print "一共计算 " & (NOK + NError) & " 道题";
Picture1.Print " 得分 " & Int(NOK / (NOK + NError) * 100)
End Sub
Private Sub cmdOk_Click()
If Val(txtInput) = Result Then
Picture1.Print SExp; txtInput; Tab(10); "√"
NOK = NOK + 1
Else
Picture1.Print SExp; txtInput; Tab(10); "ㄨ"
NError = NError + 1
End If
txtInput = ""
Form_Load
End Sub
Private Sub Form_Load()
Dim NOp As Integer, Op As String * 1
Num1 = Int(10 * Rnd + 1)
Num2 = Int(10 * Rnd + 1)
NOp = Int(4 * Rnd + 1)
Select Case NOp
Case 1
Op = "+": Result = Num1 + Num2
Case 2
Op = "-": Result = Num1 - Num2
Case 3
Op = "×": Result = Num1 * Num2
Case 4
Op = "÷": Result = Int(Num1 / Num2)
End Select
SExp = Num1 & Op & Num2 & "="
lalExp = SExp
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -