ĵ - רҵдķϷվ
ҳ > ѧ >  > 800 >

Visual Basic程序设计教程(??实验答案 - 百度文库

ʱ䣺 ղ ҪͶ

End Sub

ʵ2-1

3һ1λ12λ13λǵƽֵλСнͼ2.2.1ʾ ͼ2.2.1 ʵ2.1н ʾ 1ijΧڵʽΪ Int(Rnd*Χ+) зΧ=-+1=ޡ 磬Ҫ2λΪ Int(Rnd*(99-10+1)+10)=Int(Rnd*90+10) 2λСFormatʽΪFormat(Ҫʾֵ, \\ Private Sub Command1_Click()

Text1.Text = Int(Rnd * 9 + 1)

Text2.Text = Int(Rnd * 90 + 10)

Text3.Text = Int(Rnd * 900 + 100)

End Sub

Private Sub Command2_Click()

Text4.Text = Format((Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text)) / 3, \

End Sub

Private Sub Command3_Click()

Text1.Text = \

Text2.Text = \

Text3.Text = \

Text4.Text = \

End Sub

ʵ2-2

ҹ13˿ڣٶ˿0.8%㣬ҹ˿ڳ26ڡ ʾ 1֪r=0.8%26ڵnʽΪ УLog(x)ΪLog2ԵLog13/26,0.8%д0.008 2ĿĽ ɶơ Private Sub Command1_Click()

n = Int(Log(2) / Log(1 + 0.008) + 1)

Text1 = n & \˿ڳ26\

End Sub

ʵ2-3

һϷ3λֵϷԺʾ磬롰734ǡ437ͼ2.2.2ʾ ʾ 1Text1_LostFocus¼ݺϷԼIsNumericĽѧƪ2.5дMsgBoxʾϢͼ2.2.3ʾıķǷݣͨSetFocusλı򴦣롣 2áMOD͡\\һ3λ31λȻó˷ͼӷ㽫31λӳһ3λ ͼ2.2.2 ʵ2.3н ͼ2.2.3 Ϣ Private Sub Command1_Click()

Dim x%, x1%, x2%, x3%

x = Val(Text1)

x1 = x Mod 10

x2 = (x Mod 100) \\ 10

x3 = x \\ 100

Label2 = x1 * 100 + x2 * 10 + x3

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

If Not IsNumeric(Text1.Text) Then

Text1.Text = \

End If

End If

End Sub

Private Sub Text1_LostFocus()

If Not IsNumeric(Text1.Text) Then

MsgBox \ֵݣ\ݼ\

Text1.Text = \

Text1.SetFocus

End If

End Sub

ʵ2-4

һֱַUCaseLenMidLeftRightʾͼ2.2.4ʾЧ ͼ2.2.4 ʵ2.4н ʾ ¼̿Form_Clickб룬ؼʹñǩؼ

Visual Basic程序设计教程(??实验答案 - 百度文库

EndSubʵ2-13һ1λ12λ13λǵƽֵλСнͼ2.2.1ʾͼ2.2.1ʵ2.1нʾ1ijΧڵʽΪInt(Rnd*Χ+)зΧ=-+1=ޡ磬Ҫ2λΪInt
Ƽȣ
ĵĵΪdocʽ

ѡͼ

6ddl01i9c76msol1o4w75dq8n1si8z00ua4
ȡ

΢ɨȡ

΢ɨ