网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
有如下程序:includeusing namespace std;class Part{public:Part(int x=0):val(x){co
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout< ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是
A.123321
B.213312
C.213
D.123123
参考答案
更多 “ 有如下程序:includeusing namespace std;class Part{public:Part(int x=0):val(x){co 有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是A.123321B.213312C.213D.123123 ” 相关考题
考题
( 29 )有如下程序:#includeiostreamusing namespace std;class Part{public:Part(int x=0):val(x) {coutval;}~Part(){coutval;}private:int val;};class Whole{public:Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){coutval;}~Whole(){coutval;}private:Part p1,p2;int val;};int main(){Whole obj(1,2,3);return 0;}程序的输出结果是A ) 123321B ) 213312C ) 213D ) 123123
考题
有如下程序: include using namespace std; class Part{ public:
有如下程序: #include <iostream> using namespace std; class Part{ public: Part(int x=0):val(x) { cout<<val; } ~Part() { cout<<val; } private: int val; }; class Whole { public: Whole(int x, int y, int z=0):p2(x),p1 (y),val(z) { cout<<val; } ~whole() { cout<<val; private: Part p1,p2; int val; }; int main() { Whole obj (1,2,3); return 0; }程序的输出结果是A.123321B.213312C.213D.123123
考题
有以下程序:include using namespace std; class Base { public: Base() { K=0; } int
有以下程序:include<iostream>using namespace std;class Base{public:Base(){K=0;}int x;};class Derivedl:virtual public Base{public:Derivedl(){x=10;}};class Derived2:virtua1 public Base
考题
下列程序的运行结果是 includeclass Location{private:int X.Y;public:void init(i
下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueYA.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2
考题
有如下程序:includeusing namespace std;class Part{public:Part(int x=0):val(x) {c
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x) {cout<<val;} ~Part(){cout<<val;} private: int val; }; class Whole{ public: Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){cout<<val;} ~Whole(){cout<<val;} private: Part p1,p2; int val; }; int main() Whole obj(1,2,3); return 0; } 程序的输出结果是( )。A.123321B.213312C.213D.123123
考题
如下程序的输出结果是includevoid fun(int x=y;y=t;}int main(){in
如下程序的输出结果是 #include<iostream> void fun(int & X,inty){intt=x;x=y;y=t;} int main( ){ int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; }A.42,42B.23,23C.23,42D.42,23
考题
写出下列程序的运行结果【】。 include void func(double x, int part1, double
写出下列程序的运行结果【 】。include<iostream. h>void func(double x, int part1, double part2){part1=int(x)+500:part2=(x+500-part1)*100;}void main( ){int n;double x, f;x=1001. 0103;func (x, n, f):cout<<"Part 1="<<n<<" , part2="<<f<<end1}
考题
有如下程序: #jnCludeiostream using namespaCe std; Class Part{ publiC: Part(int x=0):val(X){Coutval;} ~Part{Coutval;} private: int val; t }; Class Whole{ publiC: Whole(int x,int Y,int z=0):p2(x),pl(y),val(z){Coutval;} ~Whole{eoutval;} private: Part pl,p2; int val; }; int main { Whole obj(1,2,3); return 0; } 执行这个程序的输出结果是( )。A.123321B.213312C.213D.123123
考题
阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。
【说明】
以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。
【C++代码】
#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}
热门标签
最新试卷