[单选题]

若有以下程序: #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

[单选题]有以下程序: #include 〈iostream〉 using namespace std; class A { public: virtual void setx(int i,int j=0) { x=i; y=j; } virtual void print()=0; protected: int x,y; }; class B : public A { public: void print() { cout〈〈x*x〈〈", "; } }; class C : public A { p

  • 查看答案
  • 有以下程序:#include 〈iostream〉using namespace

    [单选题]有以下程序: #include 〈iostream〉 using namespace std; #define M 10 #define B4 void setstar(char *a, int n) { int i; for (i=0; iA.AB C D E F G H I JB.AB C D * * * * * *C.AB C D E F * * * *D.* * * * * * A B C D

  • 查看答案
  • 若有以下程序:#include 〈iostream〉using namespac

    [单选题]若有以下程序: #include 〈iostream〉 using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout〈〈"n="〈〈n〈〈end1; } }; int main() { sample s(10); s.addv

  • 查看答案
  • 若有以下程序:#include 〈iostream〉using namespac

    [单选题]若有以下程序: #include 〈iostream〉 using namespace std; class sample { private: int i; public: void setvalue(int m) { i=m; } void fun(int m) { i+=m; } void disp() { cout〈〈i〈〈end1; } }; int main() { sample *ps; ps=new sample; ps->setvalue(20); ps->fun(

  • 查看答案
  • 若有以下程序:#include 〈iostream〉using namespac

    [单选题]若有以下程序: #include 〈iostream〉 using namespace std; class A { private: int x; public: int z; void setx(int i) { x=i; } int getx () { return x; } }; class B : public A { private: int m; public: int p; void setvalue(int a,int b, int C) { setx (A) ; z=b; m

  • 查看答案
  • 有如下程序:#include(iostream)using namespace

    [单选题]有如下程序: #include(iostream) using namespace std; class TestClass{ protected: TestClass(){couti(cout<<‘x’;} TestClass(char c){cout<<c;}}; class TestClassl:publicTestClass{ public: TestClassl(char c){cout<<c;}}; int main(){ TeA.yB.yxC.xyD.yy

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class Base{public:Base (){x=0;}int x;}若有以下程序: #include <iostream> using namespace std; class Base { public: Base () { x=0; } int x; }; class Derived1 : virtual public Base { public: Derived1 () { x=10; } }; class De

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{private:int a;public:A(int 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

  • 查看答案
  • 若有以下程序:# include using namespace std;cla

    [单选题]若有以下程序: include using namespace std;class Base{public:Base ( ){x=0;}int x若有以下程序:# include <iostream>using namespace std;class Base{public: Base ( ) { x=0; } int x;};class Derived1 : virtual public Base{public: Derived1 ( ) { x=10; }}; class Derived2

  • 查看答案
  • 若有以下程序#include using namespace std;class

    [单选题]若有以下程序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<< e

  • 查看答案
  • 若有以下程序:#include〈iostream〉using namespace