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

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

设有以下定义:class person{int num;char name[10];public:void init (int n, char *m);┇};person std [30];则下面叙述中,不正确的是( )。

A.std是一个含有30个元素的对象数组

B.std数组中的每个元素都是person类的对象

C.std数组中的每个元素都有自己的私有变量num和name

D.std数组中的每个元素都有各自的成员函数init


参考答案

更多 “ 设有以下定义:class person{int num;char name[10];public:void init (int n, char *m);┇};person std [30];则下面叙述中,不正确的是( )。A.std是一个含有30个元素的对象数组B.std数组中的每个元素都是person类的对象C.std数组中的每个元素都有自己的私有变量num和nameD.std数组中的每个元素都有各自的成员函数init ” 相关考题
考题 设有以下函数void fun(int n,char * s) { …… }则下面对函数指针的定义和赋值均是正确的是A)void (*pf)(); pf=fun;B)viod *pf(); pf=fun;C)void *pf(); *pf=fun;D)void (*pf)(int,char);pf=fun;

考题 设有定义: class person {int num; char name[10]; public: void init(int n,char*m) }; personstd[30] 则以下叙述不正确的是( )。A.std是一个含有30个元素的对象数组B.std数组中的每个元素都是person类的对象C.std数组中的每个元素都有自己的私有变量num和nameD.std数组中的每个元素都有各自的成员函数init

考题 有以下程序:includeincludeusingnameSpacestd;classperson{ intage; Char*nam 有以下程序:include <iostream>include <string>using nameSpace std;class person{int age;Char * name;public:person ( int i, Char * str ){int j;j = strlen( str ) + 1;name = new char[ j ];strcpy( name, str );age = i;}~person(){delete name;cout<<"D";}void display(){cout<<name<<":"<<age;}};int main(){person demo( 30,"Smith" );demo.display();return 0;}则该程序的输出结果为:【 】。

考题 设有以下函数: void fun(int n,char*s){…} 则下面对函数指针的定义和赋值均正确的是( )。A.void(*pf)( );pf=fun;B.void*pf( );pf=funC.void*pf( );*pf=fun;D.void(*pf)(int,char);pf=fun;

考题 设有定义:Class person{ int num; char name[10]; public: void init(int n,char*m);…};person std[30]则以下叙述不正确的是A.std是一个含有30个元素的对象数组B.std数组中的每个元素都是person类的对象C.std数组中的每个元素都有自己的私有变量num和nameD.std数组中的每个元素都有各自的成员函数init

考题 设有定义: classperson {inthum; charname[10]; public: voidinit(intn,char*m); }; personstd[30] 则以下叙述不正确的是( )。A.std是一个含有30个元素的对象数组B.std数组中的每个元素都是person类的对象C.std数组中的每个元素都有自己的私有变量num和nameD.std数组中的每个元素都有各自的成员函数init

考题 有以下程序: #include 〈iostream〉 #include 〈string〉 using namespace std; class visited { private: int number; char *name; public: static int glob; void set mes(char *a); }; void visited::set mes(char *a) { name=new char[strlen(A) +1]; strcpy(name,A) ; number=++glob; } int visited::glob-O; int main() { visited person[10]; int i; char str[8]; for(i=0;i5;i++) { cinstr; person[i] .set mes(str); } coutA.5B.4C.3D.2

考题 设有以下函数:void fun(int n,char*$s){……}则下面对函数指针的定义和赋值均正确的是A.void(*pf)( );pf=fun;B.void*Pf( );pf=fun;C.void*pf( ); *pf=fun;D.void(*pf)(int,char);nf=fun;

考题 设有以下函数:voidfun(intn,char}s){……}则下面对函数指针的定义和赋值均正确的是( )。A.void(*pf)(int,char);pf=fun;B.void+pf( );pf=fun;C.void*pf( );*pf=fun;D.void(*pf)(int,char*);pf=fun;

考题 阅读以下说明和Java程序,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。 【说明】 以下Java代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分接口、类及其关系如图5-1所示。 【Java代码】 interface?DrawCircle?{? //绘制圆形 public(1) ;}class?RedCircle?implements?DrawCircle?{? ?//绘制红色圆形???????public?void?drawCircle(int?radius,intx,?int?y)??{????????????System.out.println("Drawing?Circle[red,radius:"?+?radius?+",x:"?+?x?+?",y:"?+y+?"]");???????}}class?GreenCircle?implements?DrawCircle?{????//绘制绿色圆形??????public?void?drawCircle(int?radius,?int?x,int?y)?{???????????System.out.println("Drawing?Circle[green,radius:"?+radius+",x:?"?+x+?",y:?"?+y+?"]");??????}}abstract?class?Shape?{????//形状? protected? ? (2)???;? ? public?Shape(DrawCircle?drawCircle)?{? ?this.drawCircle=?drawCircle;? ? ? public?abstract?void?draw();}class?Circle?extends?Shape?{? //圆形? ?private?int?x,y,radius;? public?Circle(int?x,int?y,intradius,DrawCircle?drawCircle)?{? ?(3)???;? this.x?=?x;? ? ? this.y?=?y;? ?this.radius?=radius;? }? ? ?public?void?draw()?{? ? drawCircle.? ?(4)? ?;? ? ? }}public?class?DrawCircleMain?{? public?static?void?main(String[]?args)?{? Shape?redCircle=new?Circle(?100,100,10,? (5) );//绘制红色圆形? Shape?greenCircle=new?Circle(200,200,10,(6) );//绘制绿色圆形? ?redCircle.draw(); greenCircle.draw();? ?}}