• 2021-04-14
    窗体上有一个名称为 Command1 的命令按钮。其单击事件过程如下: Private Sub Command1_Click() Open "c:f1.txt" For Input As #1 Open "c:f2.txt" For Output As #2 Do While Not EOF(1) Line Input #1, str1 Print #2, str1 Loop Close End Sub 以下关于上述程序的叙述中,错误的是 ________ 。
  • 程序的功能是将f2.txt文件的内容复制到f1.txt中

    举一反三

    内容

    • 0

      在窗体上画一个通用对话框图,其Name属性为Cont,瑞画一个命令按钮,Name属性为Command1,然后编写如下事件过程: Privute Sub Command1_Click( ) Cont.FileName=" " Cont.Flags=vbOFNFileMustExist Cont.Filter="All Files| * . *" Cont.FilterIndes_3 Cont.DialogTitle="Open File" Cont.Action=1 If Cont.FileName=" " Then MsgBox "No file selected" Else Open Cont.FileName For Input As #1 Do While Not EOF(1) Input #1. b$ Print b$ Loop End If End Sub 以下各选项,对上述事件过程描述错误的是( )。 A: ++i; B: D--; C: c++; D: --f;

    • 1

      以下事件过程的功能是:从已存在于磁盘上的顺序文件Num1.txt中读取数据,计算读出数据的平方值,将该数据及其平方值存入新的顺序文件Num2.txt中。则在以下横线处合适的语句是( )。 Private Sub Form_Click() Dim x As Single,y As Single Open "Num1.txt" For Input As #1 Open "Num2.txt" For Output As #2 Do While Not EOF(1) ______ Print x y=x^2 Print y Loop Close #1,#2 End Sub A: Input #1,y Print#2,x,y B: Input #2,x Print #1,x,y C: Print #1,x Input#2,x,y D: Input #1,x Print #2,x,y

    • 2

      声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub

    • 3

      在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() a=0 For i=1 To 2 For j=1 To 4 If j Mod 2<>0 Then a=a-1 End If a=a+1 Next j Next i Print a End Sub 程序运行后,单击命令按钮,输出结果是 A: 0 B: 2 C: 3 D: 4

    • 4

      在窗体上画一个名称为Command 1命令按钮,然后编写如下事件过程: Private Sub Command1_Click() c="ABCD" For n=1 To 4 Print ▁▁▁▁ Next End Sub 程序运行后,单击命令按钮,要求在窗体上显示如下内容: D CD BCD ABCD 则在横线处填入的内容为?