网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下程序: #include<iostream> usingnamespacestd; classPair{ intm,n; public; Pair(intj,intk):m(j),n(k){} intget( ){returnIn;} intget( )const{returnm+n;} }; intmain( ){ Paira(3,5); constPairb(3,5); cout<<a.get( )t<<b.get( ); return0; } 运行时的输出结果是( )。

A.33

B.38

C.83

D.88


参考答案

更多 “ 有如下程序: #includeiostream usingnamespacestd; classPair{ intm,n; public; Pair(intj,intk):m(j),n(k){} intget( ){returnIn;} intget( )const{returnm+n;} }; intmain( ){ Paira(3,5); constPairb(3,5); couta.get( )tb.get( ); return0; } 运行时的输出结果是( )。A.33B.38C.83D.88 ” 相关考题
考题 有如下程序:includeusing namespace std;class Base{int x;public:Base(int n=0):x(n 有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;} int getX( )const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m),Base(n){tout<<m;} Derived(int m):y(m){cout<<m;} }; int main( ){ Derived dl(3),d2(5,7); return 0; } 程序的输出结果是A.375B.357C.0375D.0357

考题 有如下程序: include using namespace std; class Pair{ int m, n; public: Pair(int 有如下程序:#include<iostream>using namespace std;class Pair{int m, n;public:Pair(int j, int k):m(j), n(k){}int get(){return m;}int get()const{return m+n;)};int main() {Pair a(3, 5);const Pair b(3, 5);cout<<a. get()<<b. get();return 0;}运行时的输出结果是( )。A) 33B) 38C) 83D) 88A.B.C.D.

考题 有如下程序: include using namespace std; class Base{ public: int m,n; }; class D 有如下程序:include<iostream>using namespace std;class Base{public:int m,n;};class Derived1:【 】Base{};class Derived2:public Derived1{public:void SetMN(int M,int N){m=M;n=N;}int GetSumMN(){return(m+n);}};int main() {Derived2 objD;ohjD. SetMN(3,4);cout<<"M+N="<<objD, m+objD, n<<endl;return 0}编译时只有“cout<<"M+N"<<objD.m+objD.n<<endl;”有语法错误,程序的其他地方没有语法错误。请判断下划线处使用的关键字是什么。

考题 有如下程序: include using namespace std; class Base{ int x; pu 有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;) int getX()const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m,)Base(n){cout<<m;} Derived(int m):y(m){cout<<m;} }; int main(){ Derived d1(3),d2(5,7) return 0; }运行时的输出结果是A.375B.357C.375D.357

考题 有如下程序: #includeiostream using namespace std; class Pair{ int m,n; public: Pair(int j,int k):m(j),n(k){} int get{return m;} int getconst{return m+n;} }; int main{ Pair a(3,5); const Pair b(3,5); touta.get’b.get; return U: } 执行这个程序的输出结果是( )。A.33B.38C.83D.88

考题 有以下程序:include using namespace std;class sample {private: iht n;public: sam 有以下程序: #include <iostream> using namespace std; class sample { private: iht 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.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是A.n=10B.n=5C.n=15D.n=20

考题 有以下程序:include using namespace std;class sample{private:int n;public:sample 有以下程序: #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<<endl; } }; int main() { sample s (10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是A.n=10B.n=5C.n=15D.n=20

考题 有以下程序:includeusing namespace std;Class sample{private:int n;public:sample( 有以下程序: #include<iostream> using namespace std; Class sample { private: int n; public: sample(){} sample(int m) { n=m; } sample add(sample s1,samplc s2) { this-->n=s1.n+s2.n; return(*this); } void disp(A.n=10B.n=5C.n=20D.n=15

考题 有以下程序:includeusing namespace std;class sample{private:int n; public: sampl 有以下程序: #include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } sample add(sample s1,sample s2) { this->n=s1.n+s2.n; return(*this); }A.n=10B.n=5C.n=20D.n=15