网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下列程序的功能是:将数据1,2,…,8写入顺序文件Num.txt中,请补充完整。

Private Sub Form_Click()

Dim i As Integer

Open "Num.txt"For Output As #1

For i=1 To 8

【15】

Next i

Close #1

End Sub


参考答案

更多 “ 下列程序的功能是:将数据1,2,…,8写入顺序文件Num.txt中,请补充完整。Private Sub Form_Click()Dim i As IntegerOpen "Num.txt"For Output As #1For i=1 To 8【15】Next iClose #1End Sub ” 相关考题
考题 列程序的功能是:将数据1,2,…,10写入顺序文件Base.txt中,请填空。Private Sub Form_Click()Dim i As IntegerOpen 【11】 As #1For i=1 To 10【12】Next iClose #1End Sub

考题 下列事件过程的功能是:建立一个名为Datal的随机文件,存放角度值及这些角度的正弦函数值和余弦函数值,角度为1,2,3,…,90。请在空白处填入适当的内容,将程序补充完整。Private Type AngK As IntegerSinx As SingleCosx As SingleEnd TypeDim Ksc As AngPrivate Sub Form_Click()Dim Y As SingleOpen 【14】Y=3.14159 / 180For I=1 To 90Ksc.K=IKsc.Sinx=Sin(I * Y)Ksc.Cosx=Cos(I * Y)【15】Next IClose #2End Sub

考题 下列程序用于判断一个整数是否为质数,试将程序补充完整。Private Sub Command1_Click()Dim n As Integern = InputBox("请输入")t = Int(Sqr(n))i = 2flag = 0While i <= t And flag = 0If ______Thenflag = 1Else: i = i + 1End IfWendIf ______ThenPrint "这是一个质数"ElsePrint "这不是一个质数"End IfEnd Sub

考题 运行下列程序,单击窗体后输出的结果是( )。Private Sub Form_Click()Dim aDim s As Integer, i As Integera = Array(1, 2, 3, 4, 5, 6)s = 1For i = 5 To 1 Step -2s = s * a(i)Next iPrint sEnd SubA、 15B、 48C、 120D、 720

考题 阅读程序:Function fac(ByVal n As Integer)As IntegerDim temp As Integertemp=1For i%=1 To ntemp=temp*i%Next i%fac=tempEnd FunctionPrivate Sub Form_Click()Dim nsum As Integernsum=1For i%=2 To 4nsum=nsum+fac(i%)Next i%print nsumEnd Sub程序运行后,单击窗体,输出结果是A.35B.31C.33D.37

考题 下列程序运行时输出的结果是( )。 Option Base 1 Private Sub Form_Click() Const a=6 Dim x (a) As Integer For I=1 to a x(i)=1^2 Next I Print x(i) End SubA.36B.25C.1D.出错信息

考题 下列程序的作用是:打开顺序文件C:\stuDatA.txt,读取文件中的数据,并将数据显示在窗体上。该程序不完整,请补充完该程序。Private Sub Form_Click()【 】Do While Not EOF(1)Input 1,StrNo,StuName,StuEngPrint StuNo;Tab(10);StuName;Tab(20);StuEngLoopClose 1End Sub

考题 下列程序的功能是:将数据1,2,......,8写入顺序文件Num.txt中,请选择正确的程序段 Private Sub Form_Click() Dim i As Integer Open "Num.txt"For Output As #1 For i=1 To 8 ______ Next i Close #1 End SubA.print#1,i B.input#1,i C.print#1 D.input#1

考题 (8)下列这个Sub过程的功能是统计字符串中“a”的个数,请在空白处填上合适的代码,将程序补充完整。Private Sub numCount() Dim num As Integer s$="software And hardware" Num=Len(s$) For i=1 unm b$=。 If b$="a"Then x=x+1 Next i Print"x=";xEnd Sub

考题 (11)设有下列程序查找并输出该数组中的最小值,请在空白处填上合适的代码,将程序补充完整。 Option Base 1 Private Sub Command1_Click() Dim arr1 Dim Min As Integer,i As Integer Arr1=Array(12,435,76,-24,78,54,866,43) Min=arr1(1) For i=2 To 8 If arr1(1)Min Then Next i Print"最小值:";Min End Sud

考题 (34)下列程序的功能是:将数据1,2,…,8写入顺序文件Num.txt中,请选择正确的程序段。 Private Sub For_Click() Dim i As Integer Open "Num.txt"For Output As #1 For i=1 To 8 Next i Close #1 End SubA.Print #1,i B.input #1,I C.Print #1 D.input #1

考题 向顺序文件Temp.txt中写入1,2,3这3个数。在程序中加入以下语句的哪一项可以使程序功能完整。Private Sub Command1_Click()Open "c:\Temp.txt",Output As#1For i=0 To 3NextClose #1End SubA.Print #1,Temp.txtB.Get #1,iC.Print #1,iD.Unit #1,i

考题 下列程序 Option Base 1 Const upl = 10 Private Sub Form_click() Dim a(upl) As Integer k = -1 For i = 1 To upl a(i) = i * k k = -1 * k Next i For i = 1 To 10 Print a(i); Next End Sub 运行时输出的结果是 () 。 A. 1 3 5 7 9 10B. -1 -3 -5 -7 -9C. -1 2 -3 4 -5 6 -7 8 -9 10D. 1 -2 3 -4 5 -6 7 -8 9 -10

考题 下列程序段的功能是,单击命令按钮后,将随机产生10个三位数,并将这些数写到C盘根目录下的datA.txt文件中。请填空。Private Sub Command1_Click()Dim a As IntegerOpen【 】For Output As 100RandomizeFor i =1 To 10a=100+Int(899*RnD) 【 】Next iClose 100End Sub

考题 在窗体上画一个文本框,名称为Text1,画一个命令按钮,名称为Commandl。程序运行时,单击命令按钮,能将事先输入到文本框中的内容一个字符一个字符地写入顺序文件 test.dat中。请在空白处填上适当的内容,将程序补充完整。Private Sub Command1_Click()Open"c:\test.dat"For Output As 1For I=1 to Len(Text1.text)______Next IClose 1End Sub

考题 下面程序的功能是:用Array函数建立一个含有8个元素的数组,然后查找并在文本框Text1中输出该数组中各元素的最小值。请依据上述功能将程序补充完整。Option Base 1Private Sub Command1_Click()Dim arr1()Dim Min As Integer,i As Integerarr1=Array(12,435,76,-24,78,54,866,43)Min=______For i=2 To 8If arr l(i)<Min Then______Next iText1=MinEnd Sub

考题 阅读程序: Option Base 1 Dim art()As Integer Private Sub Form_Click() Dim i As Integer,j As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next Next ReDim Preserve ale(3,4) For j=3 To 4 arr(3,j)=j+9 Next Print arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输出结果为A.21B.13C.8D.25

考题 请阅读程序: Sub subP(b( )As Integer) For i=1 To4 b(i)=2*i Next i End Sub Private Sub Commandl Click( ) Dim a(1 To 4)As Integer a(1)=5:a(2)=6:a(3)=7:a(4)=8 subP a( ) For i=1 To 4 Print a(i) Next i End Sub 运行上面的程序,单击命令按钮,则输出结果是( )。A.2 4 6 8B.5 6 7 8C.10 12 14 16D.出错

考题 以下程序需要实现的功能是:在C盘根目录下建立一个名为Students.txt的顺序文件。单击命令按钮后,输入4个学生的个人信息,包括name、sex和age,将这些信息写入文件中。请填空。Private Sub Form_Click()Open【 】For Output As 1For i=1 To 4name=InputBox("姓名")age=InputBox("年龄")sex=InputBox("性别")Write【 】Next iClose 1End Sub

考题 执行下列程序段时,分别在输入框中输入2、4、6,则执行结果是______。 Dim A(4) As Integer Dim B(4) As Integer For i = 0 To 2 A(i + 1) = Val (InputBox (“请输入数据”)) B(3 - i) = A(i + 1) Next i Print B(i)A.2B.4C.6D.8

考题 向顺序文件Temp.txt中写入1,2,3这3个数。在程序中加入以下语句的那项可以使程序功能完整。Private Sub Command1_ClickOpen"c:\Temp.txt",Output As #1For i=0 To 3NextClose #1End SubA.Print #1,Temp.txtB.Get #1,iC.Print #1,iD.Unit #1,i

考题 向顺序文件Temp.txt中写入1,2,3这3个数。在程序中加入以下语句的那项可以使程序功能完整。 Private Sub Command1_Click() Open"c:\Temp.txt",Output As #1 For i=0 To 3 ______ Next Close #1 End SubA.Print #1,Temp.txtB.Get #1,iC.Print #1,iD.Unit #1,i

考题 下列程序的功能是:将数据1,1,…,8写入顺序文件Num.txt中,请选择正确的程序段( )。Private Sub Form_Click()Dim i As IntegerOpen"Num.txt"For Output As #1For i=1 To 8______Next iClose #1End SubA.print#1,iB.input#1,IC.print#1D.input#1

考题 下列程序的功能是:将数据1,2,…,8写入顺序文件Num.txt中,请选择正确的程序段( )。 Private Sub Form_Click() Dim i As Integer Open "Num.txt" For Output As #1 For i=1 To 8 ______ Next i Close #1 End SubA.print #1,iB.input #1,iC.print #1D.input #1

考题 下列程序的功能是:将数据1,2,…,8写入顺序文件Num.txt中,请选择正确的程序段。Private Sub Form. Click()Dim i As IntegerOpen"Num.txt" For Output As#1For i=1 To 8______Next iClose#1End SubA.print#1,iB.input #1,IC.print#1D.input#1

考题 请阅读程序. 0ption Base 1 Private Sub Fo,m Click( ) Dim Arr(4,4)As Integer For i=1 To 4 For j=1 To 4 Arr(i,j)=(i=1)*2+j Next j Next i For i=3 To 4 For j=3 To 4 Print Arr(j,i); Next j Print Next i End Sub 程序运行后,单。旨窗体,则输出结果是( )。A.5 7 6 8B.6 8 7 9C.7 9 8 10D.8 10 8 11

考题 执行下列程序后输出如下所示矩阵,填空将程序补充完整。1 0 0 20 3 4 00 5 6 07 0 0 8Private SubCommand1_Click()Dim a(4,4)For i=1 To 4For i=1 To 4If【 】Then【 】a(i,j)=kElsea(i,j)=0End IfPrint a(i,j);Next iPrintNext iEnd Sub