为使该程序执行结果为10,那么应该在程序划线处填入的语句是()。includeusing namespac 为使该程序执行结果为10,那么应该在程序划线处填入的语句是( )。 #include<iostream> using namespace std; class MyClass { public: MyClass (int a) { x=a; } ___________ //取x值 private: int x; }; int main() { MyClass my(10); cout<<my.GetNum()<<end1; return 0; }A.return x;B.int GetNum(){ return x;}C.intreturn x;D.void GetNum(){return x;}
为使该程序执行结果为10,那么应该在程序划线处填入的语句是()。includeusing namespac
为使该程序执行结果为10,那么应该在程序划线处填入的语句是( )。 #include<iostream> using namespace std; class MyClass { public: MyClass (int a) { x=a; } ___________ //取x值 private: int x; }; int main() { MyClass my(10); cout<<my.GetNum()<<end1; return 0; }
A.return x;
B.int GetNum(){ return x;}
C.intreturn x;
D.void GetNum(){return x;}
相关考题:
在下面程序的横线处填上适当的语句,使程序执行后的输出结果为ABCD。 include using nam 在下面程序的横线处填上适当的语句,使程序执行后的输出结果为ABCD。include<iostream>using namespace std;classA{public:A(){cout<<'A';}};class B:______{public:B(){cout<<'B';}};class C:______{public:C(){cout<<'C';}};class D:public B,public C{public:D(){cout<<'D';}};void main(){D obj;)
在下面程序的横线处填上适当的语句,使该程序执行结果为10。 include using namespace 在下面程序的横线处填上适当的语句,使该程序执行结果为10。include <iostream>using namespace std;class MyClass{public:MyClasS(int A){X=a;}【 】//取x的值private:int x;};int main(){MyClass my(10);
为完成下面的程序,应在划线处填入的语句是includeusingnamespace std;class Base{pri 为完成下面的程序,应在划线处填入的语句是 #include<iostream> using namespace std; class Base { private: int x; public: Base (int i) { x=i; } ~Base(){} }; class Derived:public Base { public: ______________//完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }A.Derived(int i):Base(i){}B.Derived(){}C.void Derived (int i):Base(i){}D.Derived(int i){Base(i);}
有如下程序:include using namespace std;class Base{ public: void fun() { cout 有如下程序: #include <iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun"<<endl; } }; class Derived : public Base { public: void fun() { ______ cout<<"Derived::fun"<<endl; } }; int main() { Derived d; d.fun(); return 0; } 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下划线处应填入的语句是( )。A.Base.fun();B.Base::fun();C.Base->fun();D.fun();
有如下程序: include using namespace std; class Base { public: 有如下程序: #include<iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun"<<endl; } }; class Derived: public Base { public: void tim() } ____________ cout<<"Derived:: fun"<<endl; } }; int main() { Derived d; d.fun(); return O; } 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下划线处应填入的语句是A.Base.fun();B.Base::fun();C.Base->fun();D.fun();
为完成下面的程序,应在划线处填入的语句是()。includeusingnamespacestd;classBase{pr 为完成下面的程序,应在划线处填入的语句是( )。 #include <iostream> using namespace std; class Base { private: int x; public: Base(int i) { x=i; } ~Base(){} }; class Derived : public Base { public: _______________ //完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }A.Derived(int i):Base(i){}B.Derived(){}C.voidDerived(int i):Base(0){}D.Derived(int i){Base(i);}
在下列的程序的横线处填上适当的语句,使该程序的输出为12。include using namespace 在下列的程序的横线处填上适当的语句,使该程序的输出为12。include<iostream.h>using namespace std;class Base{public:int a,b;Base(int i){a=i;}};class Derived:public Base{int a;public:Derived(int x):Base(x),b(x+1){};void show(){
在下面的程序的横线处填上适当的语句,使该程序的输出结果为12。include using namespac 在下面的程序的横线处填上适当的语句,使该程序的输出结果为12。include<iostream>using namespace std;class TestClass{public:int a,b;TestClass(int i,int j){a=i;b=j;}};class TestCla
【填空题】在下面程序下划线处填上适当内容,使程序执行结果为: 200________100 #include <iostream> using namespace std; Template(1____) T f(T x, T y){ if (sizeof(T) == (2____)) return x + y; else return x*y; } void main() { cout << f(10, 20) << "--" << (45.5, 54.5) << endl; }