vb.net做答题神器 vb制作答题软件( 二 )


Me.tx.TabIndex = 3
Me.tx.Text = "请输入x"
'
'ty
'
Me.ty.Location = New System.Drawing.Point(8, 104)
Me.ty.Name = "ty"
Me.ty.Size = New System.Drawing.Size(200, 25)
Me.ty.TabIndex = 4
Me.ty.Text = "请输入y"
'
'tz
'
Me.tz.Location = New System.Drawing.Point(8, 128)
Me.tz.Name = "tz"
Me.tz.Size = New System.Drawing.Size(200, 25)
Me.tz.TabIndex = 5
Me.tz.Text = "请输入z"
'
'ok
'
Me.ok.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.ok.Location = New System.Drawing.Point(8, 160)
Me.ok.Name = "ok"
Me.ok.Size = New System.Drawing.Size(200, 64)
Me.ok.TabIndex = 6
Me.ok.Text = "ok"
'
'ks
'
Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
Me.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(216, 232)
Me.Controls.Add(Me.ok)
Me.Controls.Add(Me.tz)
Me.Controls.Add(Me.ty)
Me.Controls.Add(Me.tx)
Me.Controls.Add(Me.l3)
Me.Controls.Add(Me.l2)
Me.Controls.Add(Me.l1)
Me.Name = "ks"
Me.Text = "考试"
Me.ResumeLayout(False)
End Sub
#End Region
Dim x, y, z, a, b, c, d, aa, bb, cc As Single
Dim tts, alls As Single
Private Sub ks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = Int(1 + 30 * Rnd())
y = Int(1 + 20 * Rnd())
z = Int(1 + 25 * Rnd())
a = Int(2 + 4 * Rnd())
b = Int(1 + a * 2 * Rnd())
c = Int(1 + b * 2 * Rnd())
d = Int(1 + c * 3 * Rnd())
aa = x + y + z
bb = a * x + b * y + c * z
cc = b * x + c * y + d * z
l1.Text = "x+y+z="Str(aa)
l2.Text = Str(a)"x+"Str(b)"y+"Str(c)"z="Str(bb)
l3.Text = Str(b)"x+"Str(c)"y+"Str(d)"z="Str(cc)
End Sub
Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click
If Val(tx.Text) = x And Val(ty.Text) = y And Val(tz.Text) = z Then
tts = tts + 1
End If
alls = alls + 1
tx.Text = ""
ty.Text = ""
tz.Text = ""
x = Int(1 + (1000 ^ 0.5) * Rnd())
y = Int(1 + (10000 ^ 0.4) * Rnd())
z = Int(1 + (100000 ^ 0.3) * Rnd())
a = Int(2 + 4 * Rnd())
b = Int(1 + a * 2 * Rnd())
c = Int(1 + b * 2 * Rnd())
d = Int(1 + c * 3 * Rnd())
aa = x + y + z
bb = a * x + b * y + c * z
cc = b * x + c * y + d * z
l1.Text = "x+y+z="Str(aa)
l2.Text = Str(a)"x+"Str(b)"y+"Str(c)"z="Str(bb)
l3.Text = Str(b)"x+"Str(c)"y+"Str(d)"z="Str(cc)
End Sub
Private Sub ks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
Dim lv As Single
If Not (alls = 0) Then
lv = Int(tts * 100000 / alls) / 1000
MsgBox(Str(lv)"%", , "正确率")
tx.Visible = False
ty.Visible = False
tz.Visible = False
ok.Visible = False
l1.Visible = False
l2.Visible = False
l3.Visible = False
Else
MsgBox("答题!", , "答题!")
End If
End Sub
End Class
在vb.net中,做一个系统答题的设计,怎么给每道题的答案积分,最后得到总分?最简单的是定义个单精度变量,比如n
然后用到If...Then... 判断语句 。
举例说明:1+1=2判断这个语句
if text1.text="2" thenn+=20'这个数值是可以随便设置的,就是这道题目的分值 。
如果有什么不明白可以QQ联系我 。
小弟要用vba做一个Excel操作题的自动阅卷系统,告诉我怎么做,多谢!VB是一种可视化编程语言vb.net做答题神器 , vb.net是vb的一个版本vb.net做答题神器,基于.net平台的版本 vba则是visual basic for application,基于应用平台的vb编程 。使用vba编程的时候不需要安装.net平台vb.net做答题神器,例如excel的vba编程就可以直接在excel中使用,编写代码,不需要安装其余软件 。至于数据库 , 从兼容性来考虑,开发excel的程序还是使用access的数据库吧,毕竟是系出同门 。

推荐阅读