首页/ 题库 / [单选题]对于下面的程序 ifstream fin的答案

对于下面的程序 ifstream fin(c: est.txt); if(fin) cout<<"ok"; else cout<<"wrong"; 对于if语句中的内容可以换为

单选题
2022-01-14 22:59
A、fin.fail( ):
B、fin.bad( );
C、fin.good( );
D、fin.eof( );
查看答案

正确答案
C

试题解析
解析:C++语言中判断文件操作成功主要有两个函数good()和fail(),其中if文件流名. good())和if(!文件流名.fail()),还有if(文件流名)都可以表示判断文件操作是否成功。

标签:
感兴趣题目
在下列程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。 #include<iostream> using namespace std; class A { public:A(){cout<<‘A’;} }; Class B: { public:B(){cout<<‘B’;} }; class C:virtual public A { public:C(){cout<<‘C’;} }; class D:p
TCP FIN属于典型的()。
TCP FIN属于典型的端口扫描类型。
Il veut faire un stage à la fin de ses études.
只具有()和FIN标志集的数据包是公认的恶意行为迹象。
使用Nmap秘密FIN数据包扫描、圣诞树(XmasTree)、空(Null)扫描的参数为()。
下列程序的运行结果是( )。 #include<stdio.h> main () { int x=5, a=1, b=2, c=5, d=O ; if (a<b) if (b!=3) if (!c) x=1; else if(d)x=1; else x=-1; printf("%d",x); }
有如下程序: #included<iostream> usingnamespqcestd; classTestClass { private; charC; public; TestClass(charn):c(n){} ~TestClass() { cout<<c; } }; classTestClassl:publicTestClass { private: charC; public: TestClassl(charn):TestClass(n+1),c(n){}~TestClassl() { cout<<c; } }; intmain() { TestClasslobj(X); return0; } 执行上面的程序将输出( )。
有以下程序 #include<iostream.h> void main( ) { int a=5,b=0,c=0; if(a=b+c) cout<<"* * *" <<endl; else cout<<"$$$"<<endl;} 下列选项叙述正确的是
以下程序的输出结果是 ______。 for (x=3;x=6;x++) { cout<<((x%2)? "**" : "#" )<<x; if(x%2= =0) cout<<end1; }
若执行下面的程序时,从键盘上输入3和4,则输出结果是main(){ int a,b,s;cin>>a>>b; s=a; if(a<B) s=b: s=s*s;cout<<s<<end1;}
有如下程序: #include<iostream> using namespace std; classA { public: A(){cout<<"A";} }; class B{public:B(){cout<<"B";}}; class C:public A { B b; public: C(){cout<<"C";} }; int main(){C obj;return 0;} 执行后的输出结果是( )
相关题目
设备驱动程序是系统提供的一种通道程序,它专门用于在请求I/O的进程与设备控制器之间传输信息下面的选项中不是设备驱动程序功能的是()
若i是int型变量,且有下面的程序片段i=0;if(i<=0) printf(####) else printf();上面程序片段的输出结果是( )
在FIN一次喷淋EG停运过程中1262-P01停后,大气腿中EG落入热井使热井液位上升。()
FIN一次喷淋EG停运时要掌握整个系统EG排空的控制点,确定每个控制点参数可靠,CP循环罐在浆料配制停止前液位降到()以下。
FIN一次喷淋EG停运步骤为()。
TCP FIN属于典型的()。
FIN及其EG喷淋冷却系统气密包括正压气密和冷态气密。()
下列哪些是FIN(VIN)number?()
如下程序的输出结果是main(){inta=2, b=-1, c=2;if(a<B) if(b<0)c=0; else c++;cout<<c<<end1;}
以下程序的输出为( )。 main() { int a=20,b=30,c=40; if(a>b)a=b, b=c;c=a; cout<< "a=" <<a<< "b=" <<b<< "c=" <<c; }
下面的程序片段y=-1;if(x!=0)if(x>0)y=1;else y=0;所表示的数学函数关系是_______。
●执行下面的一段C程序后,变量ret的值为(61)。
如下程序的输出结果是 #include<iostream> using namespace std; class A{ public: A( ){cout<<"A";} }; class B{public:B( ){cout<<"B";}}; class C:public A{ B b; public: C( ){cout<<"C";} }; int main( ){C obj;return 0;}
有以下程序 #include <stdio.h> main() { int a=1,b=2,c=3,d=0; if(a=1&& b++=2) if(b!=2||c-!=3) printf("%d,%d,%d ",a,b,c); else printf(%d,%d,%d ",a,b,c); else printf("%d,%d,%o ",a,b,c); } 程序运行后的输出结果是______。
下列程序段,运行后输出的内容是 a=2 c=1 c=c+a If c<10 Then Print c Else Print a End If
有以下程序: voidmain( ) {inta=5,b=4,c=3,d=2; if(a>b>c) cout<<d<<endl; elseif((C-1>=d)==1) cout<<d+1<<endl; else cout<<d+2<<endl; }
对于下面的程序 ifstream fin(C: est.tXt); if(fin) cout<<"ok"; else cout<<"wrong"; 对于if语句中的内容可以换为
对于下面的程序 ifstream fin(c: est.txt); if(fin) cout<<"ok"; else cout<<"wrong"; 对于if语句中的内容可以换为
下面程序输出结果是 ______。 #include<iostream. h> void main(){ int a,b,c; a=6;b=c=4; if(a!=B) if(a!=B) if(a) cout<<(a-->2); else a++; else a+=a; cout<<a; }
有以下程序: #include<iostream> using namespace std; int f(int,int); int main() { int i:1,x; x=f(i,i+1); cout<<x<<end1; return 0; } int f(int a,int b) { int c; c = a; if(a>b) c = 1; else if(a==b) c = 0; else c = -2; return c; } 运行后的输出结果是( )。
广告位招租WX:84302438

免费的网站请分享给朋友吧