好文档 - 专业文书写作范文服务资料分享网站

大一的vb期末考试题和答案

天下 分享 时间: 加入收藏 我要投稿 点赞

六、 写出下面程序的输出结果(每题4分,共24分) 1、 y=65

2、 Zheng Zhou Zhong Yuan Gong Xue Yuan 2分 ZZZG 2分 3.1 2 3 4 2 3 4.1 8 27 5.3 4 5 6 7

5 6 7 8 9 7 8 9 10 11 9 10 11 12 13 11 12 13 14 15 6.-7

七、 编写程序

1. private sub command1_click()

dim x as integer,grade as string 1分 x=text1.text 1分 select case x 4分 case 90 to 100

grade=”A” case 80 to 89

grade=”B” case 70 to 79

grade=”C” case 60 to 69

grade=”D” case is<60

grade=”E” case else

msgbox “请重新输入” end select

print “该学生成绩为”+grade 1分 end sub

2.Private Sub command1_click() Dim n as integer,f as long 1分

n=text1.text 1分 f=1

for I=1 to n 3分 f=f*I next I

text2.text=f 2分 end sub

3. Private Sub Command1_Click()

Dim a(1 To 20) As Integer ' 1分 Randomize

For i = 1 To 20 2分 a(i) = Int(Rnd * 100) Print a(i); Next Print

For i = 1 To 19 3分 For j = i + 1 To 20 If a(i) > a(j) Then

t = a(i): a(i) = a(j): a(j) = t End If Next j Next i

For i = 1 To 20 2分 Print a(i); Next i End Sub

4. Private Sub Command1_Click() Dim a(1 To 6, 1 To 6) As Integer ' 1分 Dim aver As Single Randomize

For i = 1 To 6 For j = 1 To 6

If i = j Or i + j = 7 Then a(i, j) = 1 Else

a(i, j) = Int(Rnd * 30) End If Print a(i, j); Next j Print Next i Print

Max = 0: Min = 30 4分 For i = 1 To 6 s = 0 For j = 1 To 6 s = s + a(i, j) Next j aver = s / 6

If aver > Max Then Max = aver: row_max = I If aver < Min Then Min = aver: row_min = i Next i

3分 Print row_max, row_min End Sub

5. Private Sub Command1_Click() Dim i As Integer, c As Integer Dim s As Integer

For i = 1 To 100 4分 s = s + i

If i Mod 17 = 0 Then c = c + 1 Next i

Print \ Print \能被17整数的数据有\个\ 2分 End Sub

6. Private Sub Command1_Click() Dim x As Integer

x = InputBox(\ 1分 Print x;

Max = x: Min = x: s = x 2分 For i = 2 To 10 3分 x = InputBox(\:Print x; s = s + x

If x > Max Then Max = x If x < Min Then Min = x Next i

Print s / 10 1分 Print Max, Min 1分

2分

7pgkh5o1ti0n19a8hrgx9da6a52gca00h11
领取福利

微信扫码领取福利

微信扫码分享