vb模拟练习二(参考答案)范文
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
A100
B
Label1.Left = Label1.Left C
D
Label1.Move Label1.Left
A B
C D
A B
C D
A Private Sub Command1_Click():
B Private Sub Command1_Click():
C Private Sub Text1_Change():
D Private Sub Text1_Click():
A If a ≥ b Then t=a
B
If a ≥ b Then t=a;a=b;
C If a >= b Then t=a
D If a >= b Then t=a:
A B C D A B C D
A函数的“提示信息参数”不能缺省
B 函数,只能输入一个值
C 回值是数值型的
D 的返回值必须赋予一个变量
A 如Case x ,y ,z
B 如Case "a ","b","c"
C 如Case 1 to 10
D 如Case Is <8
A B C D A B C D A B C D
A B C D A B C D A B C D
A
窗口中选择Picture属性条,然后按回车键
B Del键
C 句Picture1.Picture =
D 句Picture1.Picture =
A B C D A B C D
A age>=20 And age<=30
B age>=20 0r age<=30
C age<=20 And age>=30
D age<=20 0r age>=30
A (.vbp)
B (.frm)
C (.bas)
D 工程文件
A B
C D
A B
C D
A B
C D
A B
C
Text1_KeyPress(KeyAscii
D
A B
C D
A B C D
A TestDate = #1/1/2002#
B TestDate = #"1/1/2002"#
C TestDate = Date("1/1/2002")
D TestDate = Format("m/d/yy",
A B C D A B C D A
B
取整并输出
C
D
部分并输出
A B C D A B
C D A"12"B C"12"D
A1的值相等
B X + 1中去
C后
赋给变量X
D
A B
C D
A B
C D
A Const a As Single =
B Const a As Integer =
C
Const a As Double =
D
A B
C D
A x = Int(Rnd * n) +
B x = Int(Rnd * (n–m
C x = Int(Rnd * m) +
D x = Int(Rnd * (n-m))
A B C D A B C D A B C
D
Sin(30 * 3.14 / 180)
A B C D A B C D A B
C D
A B C D A B C D A B C D A B C D A B
D C
Const G = 23 + 12
Next i
Print a
End Sub
(4分)
2、* 对10个100以内的整数用冒泡法按递减顺序排序。
Private Sub Command1_Click()
Dim a(10) As Integer, t As Integer
Dim i As Integer, j As Integer
For i = 1 To 10
a(i) = Int(Rnd * 101)
Print a(i);
Next i: Print
For i = 1 To 9
For j = 1 To 10 - i
If a(j) < a(j + 1) Then t= a(j): a(j) = a(j + 1): a(j + 1) = t
Next j
Next i
For i = 1 To 10
Print a(i);
Next i: Print
End Sub
(4分)
3、* 删除已知数组 a 中的某个元素。
Private Sub Command1_Click()
Dim a() As Variant, n As Integer, Key As Integer
a = Array(1, 6, 8, 3, 5, 9, 10, 2, 7, 4)
n = UBound(a)
Key = InputBox("请输入要删除的数")
For i = 0 To n
If Key = a(i) Then Exit For
Next i
If i= n + 1 Then MsgBox ("找不到此数"): Exit Sub
For j = i + 1 To n
a(j - 1) = a(j)
Next j
n =n - 1
ReDim Preserve a(n)
For i = 0 To n
Print a(i);
Next i: Print
End Sub
(4分)
4、* 三个学生的四门课(政治、数学、英语、计算机)成绩(均在70分以上)随即生成存放在二维数组R(3,4)中,计算每个学生的平均成绩(存放在数组S中)和最高平均成绩。
Private Sub Form_Click()
Dim R(1 To 3, 1 To 4) As Integer
Dim S(1 To 3) As Integer
Dim i%, j%, max%, k% 'k为最高成绩学生序号
For i = 1 To 3
S(i) = 0
For j = 1 To 4
R(i, j) = Int(30 * Rnd + 70)
Print Tab((j - 1) * 5); R(i, j);
S(i) = S(i) + R(i, j)
Next j
S(i) = S(i) / 4
Next i
max = 0
For i = 1 To 3
Print "学生" & i; "平均成绩:" & S(i)