为了从当前文件夹中读入文件File1.txt,某人编写了下面的程序:
Private Sub Command1_Click()
Open "File1.txt" For Output As #20
Do While Not EOF(20)
Line Input #20, ch$
Print ch
Loop
Close #20
End Sub
程序调试时,发现有错误,下面的修改方案中正确的是( )。
发布于 2022-05-11 10:17:47
登录后免费查看答案
关注者
0
被浏览
9
1 个回答
推荐阅读
-
为丫从当前文件夹中读入文件File1.txt,某人编写了下面的程序:Private Sub Command1_Click( )Open"File1.txt"For Output As#20Do While Not EOF(20)Line Input#20,ch$Print chLoopClose#20End Sub程序调试时,发现有错误,下面的修改方案中正确的是( )。
2022-05-11 关注 0 浏览8 1答案
-
某人编写了下面的程序,希望能把text1文本框中的内容写到out.txt文件中private sub comand1_click()open "out.txt" for output as #2print "text1"close #2end sub调试时发现没有达到目的,为实现上述目的,应做的修改是
2022-05-11 关注 0 浏览13 1答案
-
某人编写了下面的程序,希望能把Text1文本框中的内容写到out.txt文件中:Private Sub Command1Click( )Open"out.txt" For Output As#2Print”Text1”Close#2End Sub调试时发现没有达到目的,为实现上述目的,应做的修改是( )。
2022-05-11 关注 0 浏览13 1答案
-
下面程序的功能是把文件file11.txt中重复字符去掉后(即若有多个字符相同,则只保留1个)写入文件file2.txt。请填空。Private Sub Command1__Click()Dim inchar AS String,temp AS String,outchar AS StringOutchar=” ”Open=”file1.txt” For Input AS #1Open=”file2.txt” For Output AS ______n=LOF(______ )inchar=Input$(n,1)For k=1 To ntemp=Mid(inchar,k,1)If InStr(outchar,temp)= ______ Thenoutchar=outchar & tempEnd IfNext kprint #2, ______close #2close #1End Sub
2022-05-11 关注 0 浏览15 1答案
-
在当前目录下有一个名为“myfile.txt”的文本文件,其中有若干行文本。下面程序的功能是读入此文件中的所有文本行,按行计算每行字符的ASCII码之和,并显示在窗体上。请填空。Private Sub Command1_Click()Dim ch$, ascii As IntegerOpen "myfile.txt" For ______ As #1While Not EOF(1)Line Input #1, chascii=toascii(______ )Print asciiWendClose #1End SubPrivate Function toascii (mystr$) As Integern=0For k=1 To ______n=n+Asc(Mid(mystr,k,1))Next ktoascii=nEnd Function
2022-05-11 关注 0 浏览18 1答案
-
下列程序的输出结果是( )。Private Sub Command1_Click( )ch$="ABCDEF"proc ch∶Print chEnd SubPrivate Sub proc(ch As String)s=“ “For k=Len(ch) To 1 Step -1s=s&Mid(ch,k,1)Next kch=sEnd Sub
2022-05-11 关注 0 浏览12 1答案
-
下面程序的输出结果是( )。Private Sub Co mmand1_Click()ch$="ABCDEF"proc ch Print chEnd SubPrivate Sub proc(ch As Stri ng)S=""For k =Len(ch)To 1Step -1s =s &Mid(ch ,k ,1)Next kch =sEnd Sub
2022-05-11 关注 0 浏览13 1答案
-
下面程序的输出结果是( )。Private Sub Co mmand1_Click()Ch$="ABCDEF"proc ch :Print chEnd SubPrivate Sub proc(ch As Stri ng)s =""For k =Len(ch)To 1Step -1s =s &Mid(ch ,k ,1)Next kch =sEnd Sub
2022-05-11 关注 0 浏览10 1答案
-
Option Base 1Dim sum(6) As IntegerPrivate Sub Command1_Click() Open App.Path & "\in5.txt" For Input As #1 Text1.Text = Input(LOF(1), #1) Close #1End SubPrivate Sub Command2_Click()=========?????=========End SubPrivate Sub Command3_Click() Open App.Path & "\out5.txt" For Output As #1 For i = 1 To 6 Print #1, sum(i) Next i Close #1End Sub
2022-05-11 关注 0 浏览37 1答案
-
Private arr(100) As IntegerPrivate n As IntegerPrivate Sub Command2_Click() Open App.Path & "\out5.txt" For Output As #1 Print #1, Text1.Text Print #1, Text2.Text Print #1, Text3.Text Print #1, Text4.Text Close #1 MsgBox "保存成功!"End SubPrivate Sub Form_Load() Open App.Path & "\in5.txt" For Input As #1 n = 0 Do While Not EOF(1) Input #1, x n = n + 1 arr(n) = x Loop Close #1End SubPrivate Sub Command1_Click()'========考生编写程序开始========???'==========考生编写程序结束==============End Sub
2022-05-11 关注 0 浏览21 1答案