有分支结构如下: if(n>100) cout<<0<<endl; else if(n==200) cout<<1<<endl; else if(n<=100) cout<<-1<<endl; else cout<<"end"<<endl; 如果n赋值为200,则输出结果为______。A.0B.1C.-1D.end

有分支结构如下: if(n>100) cout<<0<<endl; else if(n==200) cout<<1<<endl; else if(n<=100) cout<<-1<<endl; else cout<<"end"<<endl; 如果n赋值为200,则输出结果为______。

A.0

B.1

C.-1

D.end


参考答案和解析
错误

相关考题:

如有下程序:includeusing namespace std;long fun(int n){if(n>2)return(fun(n-1)+fu 如有下程序: #include<iostream> using namespace std; long fun(int n) { if(n>2) return(fun(n-1)+fun(n-2)); else return 2; } int main() { cout<<fun(3)<<endl; return 0; } 则该程序的输出结果应该是( )。A.2B.3C.D.5

( 20 )已知数组 arr 的定义如下:int arr[5] = {1,2,3,4,5};下列语句中输出结果不是 2 的是A ) cout *arr+1 endl;B ) cout *(arr+1)endl;C ) cout arr[1] endl;D ) cout *arr endl;

下列程序的输出结果为 include int func(int n) {if(n 下列程序的输出结果为#include<iostream.h>int func(int n){if(n<1) return 1;else retur n+func(n-1) ;return 0;}void main( ){cout < < func(5) < < endl;}A.0B.10C.15D.16

与语句cout< <endl; 不等价的是A.cout < <'\n';B.cout < <'\12';C.cout < <'\xA';D.cout < <'\0';

若执行以下程序时从键盘上输入9,则输出结果是main( ){int n;cin>>n;if(n++<10)cout<<n<<end1;else cout<<n - -<<end1;}A.11B.10C.9D.8

c++,运行下面代码出错 #include iostreamusing namespace std;struct student_info{ string name; int chinese; int math; int english;};student_info student[5];void inputinfo(){ int i = 0; char a[20]; for(i = 0;i 5;i++) { cout"enter the "i+1" student's information "endl; cout"enter the name"endl; cina; student[i].name = a; cout"enter chinese performance :"endl; cinstudent[i].chinese; cout"enter math performance :"endl; cinstudent[i].math; cout"enter english performance :"endl; cinstudent[i].english; }}void outputinfo(){ int i = 0; while(i 5) { couti+1" student's information"endl; coutstudent[i].name.c_str()endl; cout"chinese "endl; coutstudent[i].chineseendl; cout"math "endl; coutstudent[i].mathendl; cout"english "endl; coutstudent[i].englishendl; i++; }}int avgfunction(int arr[],int n){ int i = 0; int total = 0; for(i = 0;i n;i++) { total += arr[i]; } return total / n;}void computavg() //这里是否正确?{ int theavg = 0; theavg = avgfunction(student[i].chinese,5); }int main(){ inputinfo(); outputinfo(); computavg(); cin.get(); return 0;} 帮我找出错误 然后改过来 择优为满意答案 不分先后

请教专家,下列c++代码哪里错了?? #includeiostreamvoid main(){ int i,n,sum; cout"please input n:"endl; cinn; sum=0; for(i=1,i=n;i++); { sum+=i; } cout"运算结果为"sumendl;}

有如下4个语句:\n①cout~A~setfill(~*~)leftsetw(7)~B~endl;\n②coutsetfill(~*~)leftsetw(7)~A~~B~endl;\n③cout~A~serfill(~*~)rightsetw(7)~B~endl;\n④coutsetfill(~*~)rightsetw(7)~A~~B~endl;\n其中能显示A******B的是A、①和③B、①和④C、②和③D、②和④

以下程序的执行结果是【】。 include include void pnnt(int n) { if (n!=0 以下程序的执行结果是【 】。include<iostream.h>include<iomanip.h>void pnnt(int n){if (n!=0){Print(n-1);for (int i=1;i<=n;i++)cout<<setw(3)<<i;cout<<endl;}}void main(){print(4);}

已知数组arr的定义如下: intarr[5]={1,2,3,4,5};下列语句中输出结果不是2的是( )。A.cout*arr+1endl;B.COUt*(art+1)endl;C.coutarr[1]endl;D.COUt*arrendl:

有如下程序main( ){int n[5]={0,0,0},i,k=2;for(i=0;i<k;i++)n[i]=n[i]+1;cout<<n[k]<<endl;}该程序的输出结果是A.不定值B.2C.1D.0

下列类的构造函数不能通过编译,正确的构造函数应该是______。 include class Sample 下列类的构造函数不能通过编译,正确的构造函数应该是______。include<iostream.h>class Sample{public:int n;const int con;Sample(int m) {con=m+1;n=m;}void disp( ) {cout<<"normal:n="<<n<<endl;}void disp( )const {cout<<"static:n="<<n<<endl;}};void main( ){const Sample a (12);Sample b (13);a.disp( );b.isp( );cout<<a.n<<","<<b.con<<endl;}

有以下程序includevoid main(){int a=5,b=0,c=0;if(a=b+c)cout 有以下程序 #include<iostream.h> void main() {int a=5,b=0,c=0; if(a=b+c)cout<<"***"<<endl; else cout<<"$$$"<<<endl;} 下列选项叙述正确的是( )。A.有语法错不能通过编译B.可以通过编译但不能通过连接C.输出***D.输出$$$

下列程序的输出结果是 #include"iostream" using namespace std; int Max(int a,int b) { if(a>b) return a; else return b; } void main( ) { int m,n; m=10,n=5; int max = Max(m,n); cout<<max<<endl; }A.10B.程序有误C.1D.0

已知数组arr的定义如下: int arr[5]={1,2,3,4,5}; 下列语句中,输出结果不是2的是A.cout<<*arr+1<<endl;B.tout<<*(arr+1)<<endl;C.cout<<arr[1]<<endl;D.eout<<%arr<<endl;

若执行以下程序时从键盘上输入9,则辅出结果是 main() {int n; cin>>n; if(n++<10)cout<<n<<endl; else cout<<n--<<endl; }A.11B.10C.9D.8

有以下程序:includevoid main(){int n;cin>>n;if (n++ 有以下程序: #include<iostresm.h> void main() { int n; cin>>n; if (n++<10) cout<<n<<endl; else cout<<n--<<endl; } 若执行上述程序时,从键盘上输入9,则输出结果是( )。A.11B.10C.9D.8

下列程序的输出结果是【】。 include void main() { int i(1),j(2),k(3),a(10); if(!i 下列程序的输出结果是【 】。include<iostream.h>void main(){int i(1),j(2),k(3),a(10);if(!i)a--;else if(j)if(k)a=5;elsea=6;a++;cout<<a<<endl;if(i<j)if(i!=3)if(!k)a=1;else if(k)a=5;6+=2;cout<<a<<endl;

有以下程序()。 include int f(int n) { if(n==1)return l; else return f(n-1)+1; 有以下程序( )。 #include<iostream.h> int f(int n) { if(n==1)return l; else return f(n-1)+1; } void main() { int i,j=-; for(i=1;i<3;i++) j+=f(i); cout<j<<endl; } 程序运行后输出结果是( )。A.4B.3C.2D.1

有以下程序: main() {int a=5,b=4,c=3,d=2; if(a>b>C) cout<<d<<end1; else if((c-1)=d)==1) tout<<d+1<<endl; else cout<<d+2<<endl; }A.2B.3C.4D.编译时有错,无结果

有如下程序main( ){int n=9;while(n>6){n- -;cout<<n<<endl;)}该程序段的输出结果是A.987B.876C.8765D.9876

有以下程序main( ){ int a=5,b=4,c=3,d=2;if(a>b>c)cout<<d<<endl;else if((c-1=d)==1)cout<<d+1<<endl;elsecout<<d+2<<endl;}执行后输出结果是A.2B.3C.4D.编译时有错,无结果

与语句cout<<endl;不等价的是( )。A.cout <<’\n’;B.cout<<‘\l2’:C.cout <<’\xA’;D.cout<<‘\0’:

如下程序的输出结果是main( ){int a=2,b=-1,c=2;if(a<B)if(b<0)c=0else c++;cout<<c<<endl;}A.0B.1C.2D.3

下列语句中,输出与众不同的是A.cout<<"1."<<setfill('')<<"Hello!"<<endl;B.cout<<"1."<<''<<"Hello! \n";C.cout<<"1. Hello!"<<endl;D.cofit<<"1."<<setw(7)<<"Hello!";

有以下程序:includeusing namespace std;int main(){int n=100;cout 有以下程序: #include<iostream> using namespace std; int main(){ int n=100; cout<<dec<<n<<","; cout<<oct<<n<<","; cout<<hex<<n<<endl; return 0; } 程序运行后输出的结果是( )。A.100,100,100B.64,144,100C.100,144,64D.100,64,144

有如下程序:includeusing namespace std;long fib(int n){ if(n>2) return(fib(n-1)+ 有如下程序: #include<iostream> using namespace std; long fib(int n) { if(n>2) return(fib(n-1)+fib(n-2)); else return(n); } void main() { int i; cout<<"请输入一个整数:"; cin>>i;cout<<endl; cout<<fib(i)<<endl; { 当输入4、2时,该程序的输出结果是( )。A.5B.4C.5D.6 1 2 2 2

以下语句中,输出结果与众不同的一个是()A、cout<<"1. "<<setfill(’ ’)<< "Hello! "<<endl;B、cout<<"1."<<’ ’ <<"Hello! /n";C、cout<<"1. Hello! "<<endl;D、cout<<"1. "<<setw(7)<< "Hello! ";