打开一个有格式顺序文件,可以读文件
打开一个有格式直接文件,可以写文件
打开一个有格式直接文件,可以读写
打开一个直接文件
第1题:
此题为判断题(对,错)。
第2题:
下面程序的运算结果是( )。 #include<iostream> using namespace std; class A { public: virtual void fun()=0; }; class B:public A } public: void fun() {cout<<"new file"<<" ";} }; class C:public A { public: void fun() { cout<<"open file"<<" ";} }; void main() { A a, * p; B b;C c; p=&c; p->fun(); p=&b; }
A.new file open file
B.new file new file
C.编译出错
D.open file new file
第3题:
( 16 )要建立文件流并打开当前目录下的文件 file.dat 用于输入,下列语句中错误的是
A ) ifstream fin=ifstream.open ( "file.dat" ) ;
B ) ifstream*fir.=new ifstream ( "file.dat" ) ;
C ) ifstream fin; fin.open ( "file.dat" ) ;
D ) ifstream *fin=new ifstream ( ) ; fin 一 >open ( "file.dat" ) ;
第4题:
下列可以打开随机文件的语句是( )。
A.Open"file 1.dat"For Input As#1
B.Open"file1.dat"For Append As#1
C.Open"file1.dat"For Output As#1
D.Open"file1.dat"For Randow As#1 Len=20
第5题:
要建立文件流并打开当前目录下的文件6le.dat用于输入,下列语句中错误的是( )。
A.ifstream fin=ffstream.open(”file.dat”);
B.ifstream*fin=new ifstream(”file.dat”);
C.ifstream fin;fin.open(”file.dat”);
D.ifstream*fin=new ifstream;fin->open(”file.dat”);
第6题:
A、in_file = open('input.txt','w')
B、in_file = open('input.txt',r)
C、in_file = open('input.txt','r')
D、都不正确
第7题:
若磁盘上已存全路径文件名为c:\ctest\test.txt的文件,下面语句中不能打开该文件的是( )。
A.ifstream *pFile=new ifstream("c:\\ctest\\test.txt");
B.ifstream file("c:\\ctest\\test.txt");
C.ifstream file;file.open("c:\\ctest\\test.txt");
D.ifstream file("c:\etest\test.txt");
第8题:
下面程序的预设功能是:统计文件abc.txt中的字符个数。
include <iostream.h>
include <fstream.h>
include <stdlib.h>
void main()
{
fstream file;
file.open( "abc.txt", ios::in);
if ( !file )
{
cout<<"Can not open abc.txt"<<end1;
abort();
}
char ch;
int i = O;
while (______________)
{
file.get(ch);
i++;
}
cout<<"Characters : "<<i<<end1;
file.close();
}
则程序中空白处应该填入的语句是【 】。
第9题:
为丫从当前文件夹中读入文件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 程序调试时,发现有错误,下面的修改方案中正确的是( )。
A.在Open语句中的文件名前添加路径
B.把程序中各处的“20”改为“1”
C.把Print ch语句改为Print#20,ch
D.把Open语句中的0utput改为Input
第10题:
下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< "new file" ;} }; class C: public A{ public: void fun (){cout<<"open file"<< " " } }; class D: public A{ public: void fun () {cout<< "save file\n" ;} }; void main() { A a,*p; B b; C c; D d; p=&c; p->fun (); p=&b; p->fun (); p=&d; p->fun(); }
A.new file open file save file
B.new file new file new file
C.编译出错
D.open file new file save file