对于下面的程序: ifstream fin(c:\test.txt) ; if(fin) cout < < "ok"; else cout < < "wrong"; if语句中的内容可以换为
A.fin. fail( ) ;
B.fin. bad( ) ;
C.fin. good( ) ;
D.fin. eof( ) ;
第1题:
要建立文件流并打开当前目录下的文件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”);
第2题:
第3题:
17、以下程序段的输出结果是()。 int a=2,b=3,c=4; if(c=a+b) cout<<"OK!”; else cout<<"NO!”;
第4题:
对于下面的程序 ifstream fin(C:\test.tXt); if(fin) cout<<"ok"; else cout<<"wrong"; 对于if语句中的内容可以换为
A.fin.fail() ;
B.fin.bad() ;
C.fin,good() ;
D.fin.eof();
第5题:
下面程序代码中fin为istream流类对象,并打开了一个文件, …… while(fin) { fin>>ch>>math>>eng>>phy; { // 若读取文件数据正常 float avg=1.0*(math+eng+phy)/3; } }