Option Explicit
Private Sub Form_Click() Cls
Dim s As Long Dim i As Integer s = 1
For i = 7 To 832 s = s + i loop 30 Print s End Sub 答案:
=======(答案1)======= s =0
=======(答案2)======= For i = 7 To 832 step 30 =======(答案3)======= Next i
=========或========= Next
第35题 (1.0分) 题号:131
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:下面程序用于将十个数字从小到大排序
'------------------------------------------------ Option Explicit Option Base 1
Private Sub Form_Click() Cls
Dim a(10) As Integer
Dim i As Integer, j As Integer, temp As Integer For i = 0 To 10
If i Mod 2 = 0 Then a(i) = i Else a(i) = -i Print a(i); Next Print
For i = 1 To 10 For j = 1 To 10 - i If a(j) < a(j + 1) Then
temp = a(j): a(j) = a(j + 1): a(j + 1) = temp End If Next i, j
For i = 1 To 10 Print a(i); Next End Sub 答案:
=======(答案1)=======
For i = 1 To 10
=======(答案2)=======
If a(j) > a( j + 1 ) Then =========或=========
If a( j + 1 )
第40题 (1.0分) 题号:141
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:输出40以内能够被3整除的数,要求输出结果为5 ' 个数一行。
'------------------------------------------------ Option Explicit
Private Sub Form_Click() Cls
Dim x As Integer Dim i As Integer i = 1
For x = 1 To 40
If (x / 3) = (x \\ 3) Then Print x i = i + 1 End If
If i Mod 3 = 0 Then Print End If Next x End Sub 答案:
=======(答案1)======= i = 0
=======(答案2)======= Print x;
=======(答案3)======= if i mod 5=0 then
第42题 (1.0分) 题号:117
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:下面的程序段用于实现以下功能:建立一顺序文 ' 件,存放10名同学的学号和三门功课成绩,显示 ' 该文件内所有记录, 并同时显示其总分和平均分 '------------------------------------------------ Option Explicit
Private Sub Form_Click()
Dim no%, c1%, c2%, c3%, i As Integer
Open \For i = 1 To 10
no = InputBox(\请输入学号\ c1 = InputBox(\请输入数学成绩\ c2 = InputBox(\请输入语文成绩\ c3 = InputBox(\请输入外语\ Write #1, no, c1, c2, c2 Next i Close #1
Open \For i = 1 To 10
Print #1, no, c1, c2, c3
Print no, c1, c2, c3, c1 + c2 + c3, (c1 + c2 + c3) / 3 Next i Close #1 End Sub 答案:
=======(答案1)=======
Open \=======(答案2)=======
Open \=======(答案3)======= Input #1, n0, c1, c2, c3 第43题 (1.0分) 题号:118
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:以下程序段用于输出100-300的所有素数
'------------------------------------------------ Option Explicit
Private Sub Form_Click()
Dim n As Integer, k As Integer, i As Integer, swit As Integer For n = 101 To 300 Step 2 k = Int(Sqr(n)) i = 2 swit = 1
While swit = 0
If n Mod i = 0 Then swit = 1 Else
i = i - 1 End If Wend
If swit = 0 Then Print n; End If Next n End Sub 答案:
=======(答案1)======= swit=0
=======(答案2)=======
While i <= k And swit = 0 =========或=========
While k>=i And swit = 0 =======(答案3)======= i= i + 1
第45题 (1.0分) 题号:135
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:程序功能:求1+2+3??,直到其和超出3000为 ' 止,并输入结果。
'------------------------------------------------ Option Explicit
Private Sub Form_Click() Cls
Dim i As Integer Dim s As Single i = 1 s = 1 Do
i = i + 2 s = s + i Loop s > 3000
Print \从1 到:\的和是\End Sub 答案:
=======(答案1)======= s =0
=======(答案2)======= i = i + 1
=======(答案3)======= Loop until s > 3000 =========或========= Loop until 3000 < s
第46题 (1.0分) 题号:144
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:下面程序的作用是产生100以内的全部素数,并 ' 按每行5个数据输出。
'------------------------------------------------ Option Explicit
Private Function prime(ByVal n As Integer) Dim i As Integer prime = 1
If n <= 1 Then prime = 0
For i = 1 To n - 1
If n Mod i = 0 Then prime = 0 Next i End Function
Private Sub Form_Click()
Dim i As Integer, k As Integer k = 0
For i = 1 To 100
If prime(i) = 1 Then
Print Tab((k Mod 5) * 8); i k = k + 1
If k Mod 4 = 0 Then Print ; End If Next i End Sub 答案:
=======(答案1)======= For i = 2 To n - 1 =======(答案2)=======
Print Tab( (k Mod 5) * 8 ); i; =======(答案3)======= If k Mod 5 = 0 Then Print 第51题 (1.0分) 题号:482
'------------------------------------------------ '【程序改错】
'------------------------------------------------ '题目:请根据下列描述编写购物优惠程序。某商场为了 ' 加速促成商品流通,采用购物打折的优惠办法,每
' 位顾客一次购物(1)在100元以上者,按九五折优惠; ' (2)在200元以上者,按九折优惠;(3)300元以上 ' 者,按八折优惠;(4)500元以上者按七折优惠。 '------------------------------------------------ Option Explicit
Private Sub Command1_Click() Dim x As Single, y As Single x = Val(Text1.Text) If x < 100 Then
x = y Else
If x < 200 Then y = 0.95 * x Else
If x < 300 Then y = 0.9 * x Else
If x < 500 Then y = 0.8 * x Else