(11) 下面程序的功能是統(tǒng)計(jì)字符串中"i"的個(gè)數(shù),請(qǐng)?zhí)羁铡?/P>
Sub COU()
a$="Beijing University of Technology"
Dim n As Integer
n=Len(a$)
For i=1 To n
b$= 【12】
If 【13】 Then x=x + 1
Next i
Print "x="; x
End Sub
正確答案: 1.(Mid$(a$, i, 1) ) 2.(b$ = "i")
(12) 下列事件過(guò)程的功能是:建立一個(gè)名為Datal的隨機(jī)文件,存放角度值及這些角度的正弦函數(shù)值和余弦函數(shù)值,角度為1,2,3,…,90。請(qǐng)?jiān)诳瞻滋幪钊脒m當(dāng)?shù)膬?nèi)容,將程序補(bǔ)充完整。
Private Type Ang
K As Integer
Sinx As Single
Cosx As Single
End Type
Dim Ksc As Ang
Private Sub Form_Click()
Dim Y As Single
Open 【14】
Y=3.14159 / 180
For I=1 To 90
Ksc.K=I
Ksc.Sinx=Sin(I * Y)
Ksc.Cosx=Cos(I * Y)
【15】
Next I
Close #2
End Sub
正確答案: 1.("c:\Data1.txt" For Random As #2 Len = 10) 2.(Put #2, I)
相關(guān)推薦:
2009年9月計(jì)算機(jī)等考二級(jí)VB模擬題及解析匯總 在VB中利用遠(yuǎn)程數(shù)據(jù)庫(kù)的訪問(wèn)之應(yīng)用舉例