用VB编写下图的程序,急!!!后天就要交了!!程序能运行正确者追加50分!!

后面要有注解的,这样也能让我看得懂。谢谢O(∩_∩)O
速度,后天早上我就要交了的。程序能运行正确被采纳为最佳答案者,定追加50分!

Dim SZ1 As Integer, YSF(1 To 3) As String, SZ2 As Integer, YSFX As String, DAAN As Integer

Private Sub Command1_Click()

End

End Sub

Private Sub Command2_Click()

Dim K As String, YSS

DAAN = Val(Text3.Text)

Text2(0).Text = Val(Text2(0).Text) + 1

If YSFX = "+" Then YSS = SZ1 + SZ2

If YSFX = "-" Then YSS = SZ1 - SZ2

If YSFX = "*" Then YSS = SZ1 * SZ2

If YSS = DAAN Then

Text2(1).Text = Val(Text2(1).Text) + 1

K = "√"

Else

Text2(2).Text = Val(Text2(2).Text) + 1

K = "×"

End If

Text2(3).Text = Int(Val(Text2(1).Text) * 100 \ Val(Text2(0).Text))

Text1.Text = Text1.Text & Label5.Caption & DAAN & "   " & K & vbCrLf

Call CHUTI

Text3.Text = ""

End Sub

Private Sub Form_Load()

Text1.Text = ""

For i = 0 To 3

Text2(i).Text = 0

Next i

Text3.Text = ""

Label5.Caption = ""

Call CHUTI

End Sub

Private Sub CHUTI()

'出题

YSF(1) = "+": YSF(2) = "-": YSF(3) = "*"

Randomize

SZ1 = Int(Rnd * 9 + 1)

Randomize

SZ2 = Int(Rnd * 9 + 1)

Randomize

YSFX = YSF(Int(Rnd * 3 + 1))

If YSFX = "-" And SZ1 < SZ2 Then

M = SZ1

SZ1 = SZ2

SZ2 = M

End If

Label5.Caption = SZ1 & " " & YSFX & " " & SZ2 & " = "

End Sub

温馨提示:内容为网友见解,仅供参考
第1个回答  2010-12-06
其实写这个程序不是很难,就看你是否认真对待了,想学好一门编程语言靠的不是投机取巧,而是长时间的日积月累,很抱歉我不能帮你,还得靠你自己多多努力。本回答被网友采纳
第2个回答  2010-12-06
同意【征服月球】的观点,学习是自己的事,如果是为了敷衍,那学来做什么。
第3个回答  2010-12-06
这题很简单,主要是考察RND函数的细致用法。我们都不喜欢帮人写作业,帮你写是害你
第4个回答  2010-12-06
'新建一个txt文件。拷贝以下代码进去。另存为 文件名:题目.frm 文件类型:所有文件
'用vb打开即可。
VERSION 5.00
Begin VB.Form Frmtimu
Caption = "Form1"
ClientHeight = 4950
ClientLeft = 60
ClientTop = 345
ClientWidth = 6255
LinkTopic = "Form1"
ScaleHeight = 4950
ScaleWidth = 6255
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "结束"
Height = 375
Left = 4080
TabIndex = 12
Top = 4320
Width = 1275
End
Begin VB.Frame Frame1
Caption = "成绩"
Height = 3795
Left = 3360
TabIndex = 3
Top = 180
Width = 2655
Begin VB.TextBox Text2
Alignment = 2 'Center
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 795
Index = 3
Left = 1440
TabIndex = 11
Top = 2640
Width = 1095
End
Begin VB.TextBox Text2
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 315
Index = 2
Left = 840
TabIndex = 9
Top = 1620
Width = 1155
End
Begin VB.TextBox Text2
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 315
Index = 1
Left = 840
TabIndex = 8
Top = 1020
Width = 1155
End
Begin VB.TextBox Text2
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 315
Index = 0
Left = 840
TabIndex = 7
Top = 480
Width = 1155
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "正确率"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 435
Left = 60
TabIndex = 10
Top = 2820
Width = 1350
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "错误"
Height = 180
Left = 360
TabIndex = 6
Top = 1680
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "正确"
Height = 180
Left = 360
TabIndex = 5
Top = 1080
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "共答"
Height = 180
Left = 360
TabIndex = 4
Top = 540
Width = 360
End
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 315
Left = 1800
TabIndex = 0
Top = 4320
Width = 1035
End
Begin VB.PictureBox Picture1
Height = 3915
Left = 120
ScaleHeight = 3855
ScaleWidth = 3075
TabIndex = 1
Top = 120
Width = 3135
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Left = 1200
TabIndex = 2
Top = 4380
Width = 540
End
End
Attribute VB_Name = "Frmtimu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Type Suanshi
Num1 As Integer
Fuhao As String
Num2 As Integer
Daan As Integer
End Type
Dim timu As Suanshi
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Randomize
Call Chuti
Me.Caption = "请按回车键答题"
Text1.ToolTipText = Me.Caption
End Sub
Private Sub Chuti()
Dim temp%
Text1 = ""
timu.Num1 = Int(10 * Rnd + 1)
timu.Fuhao = Trim(Mid("+-×÷", Int(4 * Rnd + 1), 1))
timu.Num2 = Int(10 * Rnd + 1)
Select Case timu.Fuhao
Case "+": timu.Daan = timu.Num1 + timu.Num2
Case "-"
If timu.Num1 < timu.Num2 Then Call Chuti: Exit Sub
timu.Daan = timu.Num1 - timu.Num2
Case "×": timu.Daan = timu.Num1 * timu.Num2
Case "÷"
If timu.Num1 Mod timu.Num2 <> 0 Then Call Chuti: Exit Sub
timu.Daan = timu.Num1 / timu.Num2
End Select
Label1.Caption = timu.Num1 & timu.Fuhao & timu.Num2 & "="
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Picture1.Print Label1 & Text1;
Text2(0) = Val(Text2(0)) + 1
If Text1 = Trim(Str(timu.Daan)) Then
Picture1.Print Tab; "√"
Text2(1) = Val(Text2(1)) + 1
Else
Picture1.Print Tab; "×"
End If
Text2(2) = Val(Text2(0)) - Val(Text2(1))
Text2(3) = Round(Val(Text2(1)) / Val(Text2(0)) * 100)
Call Chuti
End If
End Sub
Private Sub Text2_KeyPress(Index As Integer, KeyAscii As Integer)
KeyAscii = 0
End Sub

用VB编写下图的程序,急!!!后天就要交了!!程序能运行正确者追加50...
Dim SZ1 As Integer, YSF(1 To 3) As String, SZ2 As Integer, YSFX As String, DAAN As Integer Private Sub Command1_Click()End End Sub Private Sub Command2_Click()Dim K As String, YSS DAAN = Val(Text3.Text)Text2(0).Text = Val(Text2(0).Text) + 1 If YSFX = "+...

跪求用VB程序实现矩阵转置.转置的矩阵必须是4*4的2位随机整数.后天就教...
Dim a(1 to4,1 to4) as integer for i=1 to 4 for j=1 to 4 a(i,j)=Int(10+Rnd*(90) )print a(i,j),next print next 以上是生成原矩阵4*4的2位随机整数部分主要代码 for i=1 to 4 for j=1 to 4 b=a(i,j)a(i,j)=a(j,i)a(j,i)=b next next 以上是进...

急!VB实时错误91对象变量或with块变量未设置
Dim mrc As new ADODB.Recordset

急急急!我想在ppt播放时能够课堂随机点名的vb代码。就是在ppt里支持的...
建个按钮建个文本框,这是随机抽取1到6学号的示例 Private Sub CommandButton1_Click()TextBox1.Text = Int((6 * Rnd) + 1)End Sub

关于VB中的sendkeys的问题
我不知道你的EXE是怎么启动的,不管你是手动启动还是使用Shell函数启动,VB都不可能自己知道什么时候该输入数据了,所以正确的做法是窗体启动后天加一个时间控件Timer来监视程序启动到什么地方了。监视的方法很简单,使用FindWindows函数,如果启动和启动到输入地方的窗体名是一样的,那么就查询该窗体上的子类...

为什么我编程的时候感受不到那种乐趣,也不是程序难?要怎么培养啊
再比如,编程调试时死活找不到错误会很郁闷,这个时候很多同学会束手无策,其实只要在程序不同的地方加上输出语句,然后运行看有哪些输出,这样一步步缩小错误的范围从而确定错误发生的位置。等等。。。不要畏惧困难,要用你的智慧战胜它。6.3.3多实践,多交流学习编程的秘诀是:编程,编程,再编程;(讲讲如何动手实践)在...

相似回答
大家正在搜