123*******OK
123#######OK
123********OK********
123#######OK#######
第1题:
( 34 )假定下列语句都是程序运行后首次执行的输出语句,其中输出结果与另外三条语句不同的语句是
A ) cout<<setfill ( '*' ) <<123<<setw ( 9 ) <<321;
B ) cout<<setfill ( '*' ) <<setw ( 6 ) <<left<<123<<setw ( 6 ) <<right<<321;
C ) cout<<123<<setfill ( '*' ) <<setw ( 6 ) <<321;
D ) cout<<setfill ( '*' ) <<SetW ( 9 ) <<left<<123<<321;
第2题:
有如下程序:#include <iostream>#include <iomanip>using namespace std;int main(){cout.fill('*');cout<<left<<setw(4)<<123<< "OK"<<end1;return 0;}执行这个程序的输出结果是( )。
A.123*OK
B.123*OK**
C.*123OK
D.*123**OK
第3题:
执行语句:{cout<<setfill('*')<<setw(10)<<setfill('#')<<left<<123<<"OK"<<endl;return 0;)后将输出( )。
A.123*******OK
B.123#######OK
C.123********OK********
D.123#######OK########
第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题:
若语句: cout<<seffill('>')<<setw(5)<<3141512<<sctw(5)<<"OK!"; 是程序中第1个输出语句,则输出结果是( )。
A.3141512>>OK!
B.31415120K!>>
C.314150K!>>
D.31415>>OK!
第6题:
有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*'); cout.width (6); cout.fill('#'); cout<<123<<end1; return 0; }执行后的输出结果是______ 。
A.###123
B.123###
C.***123
D.123***
第7题:
对于下面的程序 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( );
第8题:
若执行语句:cout<<setfill('*')<<setw(10)<<123<<"OK"<<end1后将输出
A.*******1230K
B.123********OK
C.*******123********OK
D.123*******OK********
第9题:
若执行语句:cout<<setfill('*')<<setw(10)<<123<<"OK"<<endl后将输出( )。
A.******* 1230K
B.123********OK
C.*******123********OK
D.123*******OK********
第10题:
执行语句:cout<<setfill('*')<<setw(10)<<setfill('#')<<left<<123<<"OK"<<endl;后将输出
A.123*******OK
B.123#######OK
C.123********OK********
D.123#######OK########
第11题:
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0; } 执行生的输出结果是( )。
A. ###123
B.123###
C. ***123
D.123***
第12题:
执行下列语句序列后, ofstream outfile("DATA.DATA") if(…)cout<<"OK";else cout<<"FAIL";如果文件打开成功显示OK,否则就显示FAIL。由此可知,…处的表达式应是( )。
A.outfile.fail()或outfile
B.outfile.fail()或! outfile
C.outfile.good()或outfile
D.outfile.goodl()或! outfile
第13题:
执行Print"A123"+123语句,系统会给出出错提示。()
第14题:
要在屏幕上显示“Hello,world!”应执行语句cout <<【 】。
第15题:
执行语句序列
ofstream outfile(“DATE.DAT”);
if(…)cout<<"OK"; else cout<<"FAIL"后,如果文件打开成功,显示“OK”,否则显示"FAIL"。由此可知,上面if语句…处的表达式是:
A.outfile.fail( )或outfile
B.outfile.good( )或outfile
C.outfile.good( )或!outfile
D.outfile.fail( )或!out file
第16题:
有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*') cout.width(6); cout.fill('#') cout<<123<<endl; return 0; } 执行后的输出结果是
A.###123
B.123###
C.***123
D.123***
第17题:
若执行语句:cout<<setfill('*')<<setw(10)<<123<<'OK'<<end1后将输出
A.*******123OK
B.123********OK
C.*******123********OK
D.123*******OK********
第18题:
执行下列语句后,输出结果为
cout.put('s');
cout<<'c'<<'a';
A.ca
B.sea
C.s
D.a
第19题:
若执行语句:cout<<setfill('*')<<setw(10)<<setfill('#')<<left<<123<<"OK"<<end1后将输出
A.123*******OK
B.123#######OK
C.123********OK********
D.123#######OK#######
第20题:
执行语句:
int result=100;
cout<<(((result>= 60)&&(result<=100))?"good":"general");结果是【 】。
第21题:
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout << left << setw(4) << 123 << "OK" << endl; return 0; }
A.123*OK
B.123*OK**
C.*123OK
D.*123**OK
第22题:
执行语句:cout<<setfill('*')<<setw(10)<<setrill('#')<<left<123<<"OK"<<endl;后将输出( )。
A.123*******0K
B.123#######OK
C.123********0K********
D.123#######OK########
第23题:
执行语句:cout<<setfill(*)<<setw(10)<<setrill()<<left<123<<"OK"<<endl;后将输出( )。
A.123*******0K
B.123OK
C.123********0K********
D.123OK