举一反三
- 中国大学MOOC: 如下输出语句的输出为____cout.width (10);cout.fill(*);cout << hex << 9;cout<< oct << 9;
- 执行如下的程序段后,输出结果是( )。 A: ut.fill('*'); cout.width(6); cout.fill(' B: '); cout << 123 << endl; C: D: 123 E: 123 F: G: ***123 H: 123***
- 下面程序段执行结果为charc='0'+2;switch{{case1:cout<<'A';break;case'2':cout<<'B';case2:cout<<'C';default:cout<<'D';};
- 给出下面程序的运行结果 #include usingnamespacestd; intmain { cout<<"This"<<""<<"is"<<""; cout<<"a"<<""<<"C++"<<""; cout<<"program."<<endl; return0; }
- #分析下面程序运行的结果。 #include usingnamespacestd; intmain { cout<<"This"<<"is"; cout<<"a"<<"C++"; cout<<"program."<<endl; return0; }#
内容
- 0
以下if语句语法正确的是( )。 A: if(x>0) cout<<xelse cout<<--x; B: if(x>0){ x=x+y; cout<<x; }else cout<<--x; C: if(x>0){ x=x+y; cout<<x; };else cout<<--x; D: if(x>0){ x=x+y; cout<<x };else cout<<--x;
- 1
写出下列程序的执行结果是:__________________。 #includeusing namespace std; void main() { int i = 1; while( i<;=10 ) if( ++i % 3 != 1 ) continue; else { cout <;<; i; if(i!=10) cout<;<;","; } }
- 2
阅读下面的程序, 请写出程序的输出结果 。 #include<iostream> using namespace std; int main () { enum Color {Red,Green,Blue}; Color color; color=Red; cout<<color<<","; color=Green; cout<<color<<","; color=Blue; cout<<color<<","; cout<<Red+Green+Blue<<endl; return 0; }
- 3
以下程序段中,语句cout< for(m=20;m>0;m--) {if(m%6==0) break; cout< }
- 4
已知数组arr的定义如下<br/>int arr[5]={1,2,3,4,5};<br/>下列语句中输出结果不是2的是 A: cout B: cout C: cout D: cout