网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
若有以下程序: #include〈iostream〉 using namespace std; int main() { int data[4],i,j,temp; for (i=O; i<4; i++) cin>>data[i]; for (i=1; i<4; i++) { j = i-1; temp = data[i]; while (data [j ] >temp&&j >=0) { data[j+1] = data[j]; j--; } data[j+1] = temp; } for(i=O;i<4;i++) cout〈〈data[i]〈〈" "; cout〈〈end1; return 0; }
A.2843
B.2348
C.8243
D.8432
参考答案
更多 “ 若有以下程序: #include〈iostream〉 using namespace std; int main() { int data[4],i,j,temp; for (i=O; i4; i++) cindata[i]; for (i=1; i4; i++) { j = i-1; temp = data[i]; while (data [j ] tempj =0) { data[j+1] = data[j]; j--; } data[j+1] = temp; } for(i=O;i4;i++) cout〈〈data[i]〈〈" "; cout〈〈end1; return 0; }A.2843B.2348C.8243D.8432 ” 相关考题
考题
以下程序运行后的输出结果是【】。 include using namespace std; int main() {int i=10,
以下程序运行后的输出结果是【 】。include<iostream>using namespace std;int main(){int i=10,i:0;do{j=j+i;i--;}while(i>2);cout<<j<<end1;return 0;}
考题
有如下程序: include using namespace std; int main(){ int sum;
有如下程序: #include<iostream> using namespace std; int main(){ int sum; for(int i=0;i<6;i+=3){ sum=i; for(int j=i;j<6;j++)sum+=j; } cout<<sum<<end1; return 0; } 运行时的输出结果是( )。A.3B.10C.12D.15
考题
有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a=i
有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j) {b=j;} void disp() {cout<<b<<“,”;A.10,10,10B.10,12,14C.8,10,12D.8,12,10
考题
有以下程序:includeusing namespace std;int main(){ inty=18,i=0,j,a[8]; do{ a[i]=
有以下程序: #include <iostream> using namespace std; int main() { int y=18,i=0,j,a[8]; do{ a[i]=y%2; i++; y=y/2; }while(y>=1); for(j=i-1;i>=0;j--) cout<<a[j]; coutA.1000B.10010C.110D.10100
考题
程序的输出结果是【 】。 include using namespace std; class A{ public: A(){a=b=2;}
程序的输出结果是【 】。include <iostream>using namespace std;class A{public:A(){a=b=2;}A(int i,int j){a=i;b=j;}void display(){cout<<a<<b;}private:int a,b;};void main(){A m,n(4,8);m.display();n.display();}
考题
有以下程序: include using namespace std; int f(int); int main() {int i;for(i=0;
有以下程序:include <iostream>using namespace std;int f(int);int main(){int i;for(i=0;i<5;i++)cout<<f(i)<<" ";return 0;}int f(int i){static int k=1;for(;i>0;i--)k+=i;
考题
有以下程序: include using namespace std; int main() {int i=010,j=10;cout
有以下程序:include <iostream>using namespace std;int main(){int i=010,j=10;cout<<(++i)<<","<<i--<<end1;return 0;}则该程序运行后的输出结果是【 】。
考题
以下程序的输出结果是【】。 include using namespace std; int main(){ int sum,i; for(
以下程序的输出结果是【 】。include<iostream>using namespace std;int main(){int sum,i;for(sum=0,i=1;i<5;i++)sum+=i;cout<<sum<<endl;return 0;}
考题
以下程序的输出结果是【】。 include using namespace std; int main() {int s,i;for(s=
以下程序的输出结果是【 】。include <iostream>using namespace std;int main(){int s,i;for(s=0,i=1;i<3;i++)s+=i;cout<<s<<end1;return 0;}
考题
若有以下程序:include using namespace std;int f(){static int i = O;ints= 1;s+=i;
若有以下程序:#include <iostream>using namespace std;int f(){ static int i = O; ints= 1; s+=i; i++; return s;}int main(){ int i, a =0; for(i=0;i<5;i++) a+=f(); cout<<a<<end1; return 0;}程序运行后,输出的结果是( )。A.20B.24C.25D.15
考题
有以下程序:include using namespace std;int main ( ){ int n[3],i,j,k = 2; for(i
有以下程序: #include <iostream> using namespace std; int main ( ) { int n[3],i,j,k = 2; for(i = 0;i<k;i++) n[i] = O; for(i = O;i<k;i++) { for(j = O;j<k;j++) n[j] = n[i] + 1; } cout<<n [0 ] <<end1; return 0; } 上述程序运行后,输出结果是( )。A.0B.1C.2D.3
考题
若有以下程序:include using namespace std;int f(){static int i = 0;int s = 1;s+=
若有以下程序: #include <iostream> using namespace std; int f() { static int i = 0; int s = 1; s+=i; i++; return s; } int main() { int i,a = 0; for(i = 0;i<5;i++) a+=f(); cout<<a<<endl; return 0; } 程序运行后,输出的结果是A.20B.24C.25D.15
考题
若有以下程序:include using namespace std;int main(){ int a[4] [4] = {{1,2,3,-4}
若有以下程序: #include <iostream> using namespace std; int main() { int a[4] [4] = {{1,2,3,-4},{0,-12,-13,14}, {-21,23,0,-24},{-31,32,-33,0}}; int i,j,s = 0; for(i=0;i<4;i++) { for(j=O;j<4;j++) { if(a[i] [j] >=0) continue; s+=a [i] [j]; } } cout<<s<<end1; return 0; } 执行后的输出结果是( )。A.-138B.141C.75D.-1
考题
若有以下程序:includeusing namespace std;int f(){ static int i=O; int s=1; s+=i;
若有以下程序: #include<iostream> using namespace std; int f() { static int i=O; int s=1; s+=i; i++; return s; } int main() { int i,a=0; for(i=0;i<5;i++) a+=f(); cout<<a<<endl; retrun 0; } 程序运行后,输出的结果是A.20B.24C.25D.15
考题
若有以下程序: include using namespace std;int f(){static int i = 0;ints= 1;s+=i
若有以下程序: #include <iostream> using namespace std; int f() { static int i = 0; ints= 1; s+=i; i++; return s; } int main() { int i,a = 0; for(i = 0;i<5;i++) a+=f(); cout<<a<<endl; return 0; } 程序运行后,输出的结果是A.20B.24C.25D.15
考题
有以下程序:includeincludeusing namespace std;int main(){ chara[] = {'a
有以下程序: #include <iostream> #include <strinq> using namespace std; int main() { char a[] = {'a'/'b'/'c'/'d','e','f','g','h','\0'}; int i j; i=sizeof(A) ; j=strlen(A) ; cout<<i<<","<<j<<end1; return 0; } 程序运行后的结果是( )。A.9,9B.8,9C.1,8D.9,8
考题
有以下程序: include using namespace std; int main() {int x;for(int i=1;i
有以下程序: #include <iostream> using namespace std; int main() { int x; for(int i=1;i<=100;i++) { x=i; if (++x%2==0) if (++x%3==0) if (++x%7==0) cout<A.39,81B.42,84C.26,68D.28,70
考题
以下程序的输出是【】。 include using namespace std; fun(intm) { static int n=1; n=m
以下程序的输出是【 】。include<iostream>using namespace std;fun(intm){static int n=1;n=m*n;return(n);}void main(){int i;for(i=1;i<=3;i++) cout<<fun(i);}
考题
若有以下程序include using namespace std;class A{public: A(int i,int j) {a=i;b=j
若有以下程序 #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x, int y) { a+=x; b+=y; } void show() { cout < <a < <" , " <<b<< end1; } private: int a,b; }; class B : private A { public: B(int i,int j) :A(i,j) {} void fun ( ) { move (3, 5); } void f1 ( ) { A::show(); } }; int main ( ) { B d(3,4); d. fun ( ); d.f1(); return 0; } 程序执行后的输出结果是 ( )。A.3,4B.6,8C.6,9D.4,3
考题
有以下程序: include using namespace std; int main() {int i=1,sum=0;Loop:if(i
有以下程序:include<iostream>using namespace std;int main(){int i=1,sum=0;Loop:if(i<=20){sum+=i;i++;goto Loop;}cout<<sum<<end1;return 0;}该程序运行后的输出结果是【 】。
考题
有以下程序:include using namespace std;void fun(int i,int j){ cout
有以下程序: #include <iostream> using namespace std; void fun(int i,int j) { cout<<(i+j)<<end1; } void fun(int i) { cout<<i++<<end1; } int main() { int a=1; fun(A) ; return 0; } 该程序执行后的输出结果是( )。A.1B.2C.3D.4
考题
有下列程序: include using namespace std; classBase { protected: int i; public
有下列程序: #include<iostream.h> using namespace std; classBase { protected: int i; public: int j; }; classDerived:public Base { int m; public: intn; }; intA.[1]和[2]B.[1)和[3]C.[2]和[3]D.[2]和[4]
考题
若有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a
若有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j {b=j;} void disp() {cout<<b<<A.10,10,10B.10,12,14C.8,10,12D.8,12,10
考题
若有以下程序:includeusing namespace std;class A{public:A(int i,int j){a=i;b=j;}
若有以下程序: #include<iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x,int y) { a+=x; b+=y; } void show() { cout<<a<<","<<b<<endl; } private: int a,b; }; class B:private A { public: B(int i,int j):A(i,j){} void fun() { move(3,5); } void fl() { A::show(); } }; int main() { B d(3,4); d.fun(); d.fl(); return 0; } 程序执行后的输出结果是( )。A.3,4B.6,8C.6,9D.4,3
考题
若有以下程序:include using namespace std;class Base{private: int x;protected: i
若有以下程序: #include <iostream> using namespace std; class Base { private: int x; protected: int y; public: int z; void setx(int i) { x=i; int getx () { return x; } }A.1,2,3,4B.产生语法错误C.4,3,2,1D.2,3,4,5
考题
下面程序的输出结果是()。include using namespace std;void main( ){ inta[3][3] ={{
下面程序的输出结果是( )。 #include <iostream> using namespace std; void main( ) { inta[3][3] ={{1,2},{3,4},{5}}; int s =0; for(int i=1;i<3;i++) for(int j=0;j<=i;j++) s+=a[i][j]; cout<<s<<endl;A.12B.4C.15D.13
考题
若有以下程序include using namespace std;class A {public: A(int i,int j) {a=i;b=
若有以下程序 #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x,int y) { a+=x; b+=y; } void show() cout<<a<<","<<b<<end1; private int a,b; }; class B: private A { public: B(int i,int j):A(i,j) {} void fun() { move(3,5); } void fl() { A::show(); } int main() { B d(3,4); d. fun(); d.fl(); return 0; } 程序执行后的输出结果是A.3,4B.6,8C.6,9D.4,3
热门标签
最新试卷