网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
( 35 )有如下程序:
#include<iostream>
using namespace std;
class ONE{
int c;
public:
ONE ( ) : c ( 0 ) {cout<<1;}
ONE ( int n ) : c ( n ) {cout<<2;}
};
class TWO{
ONE onel;
ONE one2;
public:
TWO ( int m ) : one2 ( m ) {cout<<3;}
};
int main () t
TWO t ( 4 )
return 0
}
运行时的输出结果是
A ) 3
B ) 23
C ) 123
D ) 213
参考答案
更多 “ ( 35 )有如下程序:#includeiostreamusing namespace std;class ONE{int c;public:ONE ( ) : c ( 0 ) {cout1;}ONE ( int n ) : c ( n ) {cout2;}};class TWO{ONE onel;ONE one2;public:TWO ( int m ) : one2 ( m ) {cout3;}};int main () tTWO t ( 4 )return 0}运行时的输出结果是A ) 3B ) 23C ) 123D ) 213 ” 相关考题
考题
有以下程序#include stdio.h#include string.hmain(){ char str[ ][20]={"One*World","One*Dream!"},*p=str[1];printf("%d,",strlen(p));printf("%s\n",p);}程序运行后的输出结果是A)9,One*WorldB)9,One*Dream !C)10,One*Dream !D)10,One*World
考题
定义如下变量:char one_char,则语句cin>>one_char等价于C语言中的( )语句。A.printf(one_char);B.prinft("%c",one_char);C.scanf(one_char);D.scanf("%c", one_char);
考题
有如下程序:#includeiostreamusing narnespace std;class ONE{int e;public:ONE():c(O){cout1;)ONE(int n):c(13){cout2;}};class TWO{ONE oriel;ONE one2,public:TWO(int m):one2(m){cout3;}};int main(){TWO t(4);return O;}运行时的输出结果是A.3B.23C.123D.213
考题
有以下程序#includestdio.h#includestring.hmain( ){char str[][20]={“Qne*World”,“one*Dream!”},*P=str[1 ].prinff(“%d,”,strlen(p));printf(“%s\n”,P); ’}程序运行后的输出结果是A.9,One*World S)9,One*Dream!B.10,One*Dream!C.10,One*World
考题
有以下程序#includestdio.h#includestring.hmain( ){char str[][20]={“Qne*World”,“one*Dream!”},*P=str[1 ].prinff(“%d,”,strlen(p));printf(“%s\n”,P); ’}程序运行后的输出结果是A.9,One*World S)B.9,One*Dream!C.10,One*Dream!D.10,One*World
考题
定义如下变量:char one_char;,则语句cout<<one_char;显示结果相当于C语言中的( )语句。A.printf(one_char);B.prinff("%c",one_char);C.scanf(one_char);D.scanf("%c",one_char);
考题
阅读下列说明和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;}
热门标签
最新试卷