下列事件過程的功能是:建立一個名為Data1的隨機文件,存放角度值及這些角度的正弦函數(shù)值和余弦函
下列事件過程的功能是:建立一個名為Data1的隨機文件,存放角度值及這些角度的正弦函數(shù)值和余弦函數(shù)值,角度為1,2,3,…,90。請在空白處填入適當?shù)膬?nèi)容,將程序補充完整( )。
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
Dim i As Integer
Dim Ksc As Ang
Open______
Y=3.14159/180
For i=1 To 90
Ksc.K=i
Ksc.Sinx=Sin(i*Y)
Ksc.Cosx=Cos(i*Y)
Next i
Close #2
End Sub
A...\Data1.txtFor Random As #1 Len=10 Put#1,i,Ksc
B...\Data1.txtFor Random As #1 Len=10 Put#1,Y,Ksc
C...\Data1.txtFor Random As #1 Put#1,i,Ksc
D...\Data1.txtFor Random As #1 Put#1,Y,Ksc
正確答案:A解析:分析程序,程序要將角度值及這些角度的正弦函數(shù)值和余弦函數(shù)值存入Data1文件中。因此,應(yīng)先打開Data1文件,因為Data1文件是隨機文件,要新建并寫入信息,所以使用Random方式打開文件。這里給隨機文件指定長度為10,所以第1個空白處應(yīng)填"..\Data1.txt"For Random As #1 Len=10。要向隨機文件中寫入信息,應(yīng)用Put語句,因此第2空應(yīng)填Put #1,i,Ksc。
詞條內(nèi)容僅供參考,如果您需要解決具體問題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。