用VB制作考试系统
如题有登陆界面,结合SQL或excel随即选题,然后有个答题系统,最后能给出成绩。期间有时间计时器...
如题有登陆界面,结合SQL或excel随即选题,然后有个答题系统,最后能给出成绩。期间有时间计时器
展开
2个回答
推荐于2018-04-10
展开全部
Dim a, b, c, d, e, f, g, x, y, z, s, mPrivate Sub C1_Click()
Timer1.Enabled = True
ct.Enabled = True
pd.Enabled = True
fh.Enabled = True
zt.Enabled = True
C1.Enabled = False
jx.Enabled = True
Text4.SetFocus
End SubPrivate Sub ct_Click()
m = m + 1
Text4.SetFocus
a1:
e = Int(Rnd() * 100) Mod 4
f = Int(Rnd() * 100) Mod 4
If O1.Value = True Then
a = Int(Rnd() * 10)
b = Int(Rnd() * 10)
c = Int(Rnd() * 10)
ElseIf O2.Value = True Then
a = Int(Rnd() * 20)
b = Int(Rnd() * 20)
c = Int(Rnd() * 20)
ElseIf O3.Value = True Then
a = Int(Rnd() * 50)
b = Int(Rnd() * 50)
c = Int(Rnd() * 50)
Else
e = 5
f = 5
nd = MsgBox("你还没有选择题目的难易程度!", 64, "选择")
End If
If (b = 0 And e = 3) Or (c = 0 And f = 3) Then GoTo a1
Select Case e
Case 0
Lab2.Caption = "+"
Case 1
Lab2.Caption = "-"
Case 2
Lab2.Caption = "×"
Case 3
Lab2.Caption = "÷"
End Select
Select Case f
Case 0
Lab3.Caption = "+"
Case 1
Lab3.Caption = "-"
Case 2
Lab3.Caption = "×"
Case 3
Lab3.Caption = "÷"
End Select
Text1.Text = a
Text2.Text = b
Text3.Text = c
If e = 0 And f = 0 Then
g = a + b + c
ElseIf e = 0 And f = 1 Then
g = a + b - c
ElseIf e = 0 And f = 2 Then
g = a + (b * c)
ElseIf e = 0 And f = 3 Then
g = a + (Int(b / c * 100 + 0.5)) / 100
ElseIf e = 1 And f = 0 Then
g = a - b + c
ElseIf e = 1 And f = 1 Then
g = a - b - c
ElseIf e = 1 And f = 2 Then
g = a - (b * c)
ElseIf e = 1 And f = 3 Then
g = a - (Int(b / c * 100 + 0.5)) / 100
ElseIf e = 2 And f = 0 Then
g = a * b + c
ElseIf e = 2 And f = 1 Then
g = a * b - c
ElseIf e = 2 And f = 2 Then
g = a * b * c
ElseIf e = 2 And f = 3 Then
g = (Int(a * b / c * 100 + 0.5)) / 100
ElseIf e = 3 And f = 0 Then
g = (Int(a / b * 100 + 0.5)) / 100 + c
ElseIf e = 3 And f = 1 Then
g = (Int(a / b * 100 + 0.5)) / 100 - c
ElseIf e = 3 And f = 2 Then
g = (Int(a / b * 100 + 0.5)) / 100 * c
ElseIf e = 3 And f = 3 Then
g = (Int(a / b / c * 100 + 0.5)) / 100
End If
End Sub
Private Sub fh_Click()
If jx.Enabled = False Then
hunhe.Hide
xuanze.Show
C1.Enabled = True
Else
jxa = MsgBox("你还没有结束练习!", 48, "警告")
End If
End SubPrivate Sub Form_Load()
Lab1.Caption = "0时00分00秒"
s = 0
d = 0
m = 0
ct.Enabled = False
pd.Enabled = False
jx.Enabled = False
zt.Enabled = False
End SubPrivate Sub jx_Click()
jx1 = MsgBox("你真的要结束练习吗?", 36, "提示")
If jx1 = vbYes Then
jg = MsgBox("你的得分是" & d & "分;你一共做了" & m & "个题,做对了" & d / 10 & "个;你的练习时间是" & Lab1.Caption & "。", 64, "最后成绩")
Timer1.Enabled = False
Lab1.Caption = "0时00分00秒"
jx.Enabled = False
zt.Enabled = False
C1.Enabled = False
ct.Enabled = False
pd.Enabled = False
d = 0
m = 0
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Lab2.Caption = ""
Lab3.Caption = ""
Text4.SetFocus
Else
Cancel = 1
End If
End SubPrivate Sub pd_Click()
If Text1.Text = "" Then
Label7.Caption = "你还没有抽题,请抽题!"
ElseIf Text4.Text = "" Then
Label7.Caption = "你还没有做题,请做题!"
Text4.SetFocus
ElseIf Text4.Text = g Then
Label7.Caption = "恭喜你,做对了,加10分!"
d = d + 10
Lab4.Caption = d
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Lab2.Caption = ""
Lab3.Caption = ""
Else
Label7.Caption = "你做错了,请重新做题!"
Text4.Text = ""
Text4.SetFocus
End If
End SubPrivate Sub Timer1_Timer()
s = s + 1
x = s Mod 60
y = (Int(s / 60)) Mod 60
z = Int(Int(s / 60) / 60)
If x < 10 And y < 10 Then
Lab1.Caption = z & "时0" & y & "分0" & x & "秒"
ElseIf x < 10 And y > 9 Then
Lab1.Caption = z & "时" & y & "分0" & x & "秒"
ElseIf x > 9 And y < 10 Then
Lab1.Caption = z & "时0" & y & "分" & x & "秒"
Else
Lab1.Caption = z & "时" & y & "分" & x & "秒"
End If
End SubPrivate Sub zt_Click()
Timer1.Enabled = False
C1.Enabled = True
ct.Enabled = False
pd.Enabled = False
zt.Enabled = False
End Sub
我不知道对不对
Timer1.Enabled = True
ct.Enabled = True
pd.Enabled = True
fh.Enabled = True
zt.Enabled = True
C1.Enabled = False
jx.Enabled = True
Text4.SetFocus
End SubPrivate Sub ct_Click()
m = m + 1
Text4.SetFocus
a1:
e = Int(Rnd() * 100) Mod 4
f = Int(Rnd() * 100) Mod 4
If O1.Value = True Then
a = Int(Rnd() * 10)
b = Int(Rnd() * 10)
c = Int(Rnd() * 10)
ElseIf O2.Value = True Then
a = Int(Rnd() * 20)
b = Int(Rnd() * 20)
c = Int(Rnd() * 20)
ElseIf O3.Value = True Then
a = Int(Rnd() * 50)
b = Int(Rnd() * 50)
c = Int(Rnd() * 50)
Else
e = 5
f = 5
nd = MsgBox("你还没有选择题目的难易程度!", 64, "选择")
End If
If (b = 0 And e = 3) Or (c = 0 And f = 3) Then GoTo a1
Select Case e
Case 0
Lab2.Caption = "+"
Case 1
Lab2.Caption = "-"
Case 2
Lab2.Caption = "×"
Case 3
Lab2.Caption = "÷"
End Select
Select Case f
Case 0
Lab3.Caption = "+"
Case 1
Lab3.Caption = "-"
Case 2
Lab3.Caption = "×"
Case 3
Lab3.Caption = "÷"
End Select
Text1.Text = a
Text2.Text = b
Text3.Text = c
If e = 0 And f = 0 Then
g = a + b + c
ElseIf e = 0 And f = 1 Then
g = a + b - c
ElseIf e = 0 And f = 2 Then
g = a + (b * c)
ElseIf e = 0 And f = 3 Then
g = a + (Int(b / c * 100 + 0.5)) / 100
ElseIf e = 1 And f = 0 Then
g = a - b + c
ElseIf e = 1 And f = 1 Then
g = a - b - c
ElseIf e = 1 And f = 2 Then
g = a - (b * c)
ElseIf e = 1 And f = 3 Then
g = a - (Int(b / c * 100 + 0.5)) / 100
ElseIf e = 2 And f = 0 Then
g = a * b + c
ElseIf e = 2 And f = 1 Then
g = a * b - c
ElseIf e = 2 And f = 2 Then
g = a * b * c
ElseIf e = 2 And f = 3 Then
g = (Int(a * b / c * 100 + 0.5)) / 100
ElseIf e = 3 And f = 0 Then
g = (Int(a / b * 100 + 0.5)) / 100 + c
ElseIf e = 3 And f = 1 Then
g = (Int(a / b * 100 + 0.5)) / 100 - c
ElseIf e = 3 And f = 2 Then
g = (Int(a / b * 100 + 0.5)) / 100 * c
ElseIf e = 3 And f = 3 Then
g = (Int(a / b / c * 100 + 0.5)) / 100
End If
End Sub
Private Sub fh_Click()
If jx.Enabled = False Then
hunhe.Hide
xuanze.Show
C1.Enabled = True
Else
jxa = MsgBox("你还没有结束练习!", 48, "警告")
End If
End SubPrivate Sub Form_Load()
Lab1.Caption = "0时00分00秒"
s = 0
d = 0
m = 0
ct.Enabled = False
pd.Enabled = False
jx.Enabled = False
zt.Enabled = False
End SubPrivate Sub jx_Click()
jx1 = MsgBox("你真的要结束练习吗?", 36, "提示")
If jx1 = vbYes Then
jg = MsgBox("你的得分是" & d & "分;你一共做了" & m & "个题,做对了" & d / 10 & "个;你的练习时间是" & Lab1.Caption & "。", 64, "最后成绩")
Timer1.Enabled = False
Lab1.Caption = "0时00分00秒"
jx.Enabled = False
zt.Enabled = False
C1.Enabled = False
ct.Enabled = False
pd.Enabled = False
d = 0
m = 0
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Lab2.Caption = ""
Lab3.Caption = ""
Text4.SetFocus
Else
Cancel = 1
End If
End SubPrivate Sub pd_Click()
If Text1.Text = "" Then
Label7.Caption = "你还没有抽题,请抽题!"
ElseIf Text4.Text = "" Then
Label7.Caption = "你还没有做题,请做题!"
Text4.SetFocus
ElseIf Text4.Text = g Then
Label7.Caption = "恭喜你,做对了,加10分!"
d = d + 10
Lab4.Caption = d
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Lab2.Caption = ""
Lab3.Caption = ""
Else
Label7.Caption = "你做错了,请重新做题!"
Text4.Text = ""
Text4.SetFocus
End If
End SubPrivate Sub Timer1_Timer()
s = s + 1
x = s Mod 60
y = (Int(s / 60)) Mod 60
z = Int(Int(s / 60) / 60)
If x < 10 And y < 10 Then
Lab1.Caption = z & "时0" & y & "分0" & x & "秒"
ElseIf x < 10 And y > 9 Then
Lab1.Caption = z & "时" & y & "分0" & x & "秒"
ElseIf x > 9 And y < 10 Then
Lab1.Caption = z & "时0" & y & "分" & x & "秒"
Else
Lab1.Caption = z & "时" & y & "分" & x & "秒"
End If
End SubPrivate Sub zt_Click()
Timer1.Enabled = False
C1.Enabled = True
ct.Enabled = False
pd.Enabled = False
zt.Enabled = False
End Sub
我不知道对不对
2013-08-31
展开全部
厄。。。系统代码我有。是我们原来开发的。包括服务器,客户端,SQL三大模块。是给一中专院校开发的。当时卖就卖2万。不过这是前几年的事了。lz想要,分也太少了。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询