11.以下程序段:
Private Sub Form_Load( )
Dim Nop As Integer, Op As String * 1
Num1 = 3
Num2 = 2
Nop = val(Inputbox("請(qǐng)輸入1-4之間的整數(shù)"))
Select Case Nop
Case 1
Op = "+"
Result = Num1 + Num2
Case 2
Op = "-"
Result = Num1 - Num2
Case 3
Op = "×"
Result = Num1 * Num2
Case 4
Op = "÷"
Result = Num1 / Num2
End Select
Label1= Num1 & Op & Num2 & "=" & Result
End Sub
窗體運(yùn)行后,輸入2,則label1的標(biāo)題顯示結(jié)果為(B)(單)
A.3+2=5
B.3-2=1
C.3×2=6
D.3÷2=1.5
12.以下程序段:
Private Sub Form_Load( )
Dim Nop As Integer, Op As String * 1
Num1 = 3
Num2 = 2
Nop = val(Inputbox("請(qǐng)輸入1-4之間的整數(shù)"))
Select Case Nop
Case 1
Op = "+"
Result = Num1 + Num2
Case 2
Op = "-"
Result = Num1 - Num2
Case 3
Op = "×"
Result = Num1 * Num2
Case 4
Op = "÷"
Result = Num1 / Num2
End Select
Label1= Num1 & Op & Num2 & "=" & Result
End Sub
窗體運(yùn)行后,輸入3,則label1的標(biāo)題顯示結(jié)果為(C)(單)
A.3+2=5
B.3-2=1
C.3×2=6
D.3÷2=1.5
13.以下程序段:
Private Sub Form_Load( )
Dim Nop As Integer, Op As String * 1
Num1 = 3
Num2 = 2
Nop = val(Inputbox("請(qǐng)輸入1-4之間的整數(shù)"))
Select Case Nop
Case 1
Op = "+"
Result = Num1 + Num2
Case 2
Op = "-"
Result = Num1 - Num2
Case 3
Op = "×"
Result = Num1 * Num2
Case 4
Op = "÷"
Result = Num1 / Num2
End Select
Label1= Num1 & Op & Num2 & "=" & Result
End Sub
窗體運(yùn)行后,輸入4,則label1的標(biāo)題顯示結(jié)果為(D)(單)
A.3+2=5
B.3-2=1
C.3×2=6
D.3÷2=1.5
14.以下程序段的作用是(A)(單)
Private Sub Picture1_Click( )
Dim asci As Integer, i As Integer
i = 0
For asci = 32 To 126
Picture1.Print Tab(7 * i + 2); Chr(asci); "="; asci;
i = i + 1
If i = 7 Then i = 0: Picture1.Print
Next asci
A.打印ASCII碼表,一行7個(gè)表達(dá)式
B.打印九九乘法表,一行7個(gè)表達(dá)式
C.打印ASCII碼表,一行8個(gè)表達(dá)式
D.以上說(shuō)法都不正確
15.我國(guó)現(xiàn)在人口有13億,按人口增長(zhǎng)0.8%計(jì)算,多少年后我國(guó)人口將超過(guò)26億。
Private Sub Command1_Click( )
Dim x, n
x = Val(Text1)
n = 0
Do While 【x】<26
x = x * (1 + 0.008)
n = n + 1
Loop
Text2 = Str(n)
End Sub
16.以下程序的作用是(B)(單)
For i = 1 To 9
For j = 1 To 9
se = i & "×" & j & "=" & i * j
Picture1.Print Tab((j - 1) * 9 + 1); se;
Next j
Picture1.Print
Next i
A.打印ASCII碼表
B.打印九九乘法表
C.打印加法表
D.以上說(shuō)法都不正確
17.求自然數(shù)e的近似值,誤差小于0.00001,近似公式為:e=1+1/1!+1/2!+1/3!+……+1/I!+……以下程序用來(lái)求自然數(shù)e。
Private Sub Form_Click( )
Dim I%, n&, t!, e!
E = 0 ' 存放累加和結(jié)果
I = 0 ' 計(jì)數(shù)器
n = 1 ' 存放階乘的值
t = 1 ' 級(jí)數(shù)第I項(xiàng)值
Do While 【t>】 0.00001
e = e + t
I = I + 1
n = n * I
t = 1 / n
Loop
Print "計(jì)算了 "; I; " 項(xiàng)的和是 "; e
End Sub
18.求自然數(shù)e的近似值,誤差小于0.00001,近似公式為:e=1+1/1!+1/2!+1/3!+……+1/I!+……以下程序用來(lái)求自然數(shù)e。
Private Sub Form_Click( )
Dim I%, n&, t!, e!
E = 0 ' 存放累加和結(jié)果
I = 0 ' 計(jì)數(shù)器
n = 1 ' 存放階乘的值
t = 1 ' 級(jí)數(shù)第I項(xiàng)值
Do While t>0.00001
e = e + 【t】
I = I + 1
n = n * I
t = 1 / n
Loop
Print "計(jì)算了 "; I; " 項(xiàng)的和是 "; e
End Sub
19.求自然數(shù)e的近似值,誤差小于0.00001,近似公式為:e=1+1/1!+1/2!+1/3!+……+1/I!+……以下程序用來(lái)求自然數(shù)e。
Private Sub Form_Click( )
Dim I%, n&, t!, e!
E = 0 ' 存放累加和結(jié)果
I = 0 ' 計(jì)數(shù)器
n = 1 ' 存放階乘的值
t = 1 ' 級(jí)數(shù)第I項(xiàng)值
Do While t>0.00001
e = e + t
I = I + 1
n = n * 【I】
t = 1 / n
Loop
Print "計(jì)算了 "; I; "項(xiàng)的和是"; e
End Sub
20.以下程序是求最大公約數(shù)和最小公倍數(shù)的程序。
Private Sub Form_Click( )
Dim m1, n1, m, n, r As Integer
n1 = InputBox("輸入自然數(shù)n", "輸入數(shù)")
m1 = InputBox("輸入自然數(shù)m", "輸入數(shù)")
n = n1
m = m1
If m < n Then
t = m: m = n: n = t
End If
r = m Mod 【n】
Do While (r<>0)
m = n
n = r
r = m Mod n
Loop
Print "最大公約數(shù)=", n
Print "最小公倍數(shù)= ", m1 * n1 / n
End Sub
2015年全國(guó)職稱計(jì)算機(jī)考試教材(2007模 .. 定價(jià):¥225 優(yōu)惠價(jià):¥213 更多書籍 | |
全國(guó)職稱計(jì)算機(jī)考試速成過(guò)關(guān)系列套裝:W .. 定價(jià):¥133 優(yōu)惠價(jià):¥133.0 更多書籍 |