题目详情
当前位置:首页 > 计算机考试 > 计算机等级考试
题目详情:
发布时间:2023-10-19 22:59:00

[单项选择]有以下类定义 classPoint{ public: Point(int x=0,int y=0){_x=x;_y=y;} void Move (int xOff,int yOff {_x +=xOff;_y+yOff} void Print( ) const {cout<<’(’<<_x<<’,’<<_y<<’)’<<endl;} private: int_x_y; }; 下列语句中会发生编译错误的是
A. Pointpt;pt;Print();
B. const Point pt;pt.Print();
C. Pointpt;pt.Move(1,2);
D. const Point pt;pt.Move(1,2);

更多"有以下类定义 classPoint{ public: Po"的相关试题:

[单项选择]有以下类定义 classPoint{ public: Point(int x=0,int y=0){_x=x;_y=y;} void Move (int xOff,int yOff {_x +=xOff;_y+yOff} void Print( ) const {cout<<’’(’’<<_x<<’’,’’<<_y<<’’)’’<<endl;} private: int_x_y; }; 下列语句中会发生编译错误的是【 】
A. Pointpt;pt;Print();
B. const Point pt;pt.Print();
C. Pointpt;pt.Move(1,2);
D. const Point pt;pt.Move(1,2);
[单项选择]有以下类定义: class Point { public: Point(int x=0,int y=0){_x=x; _y=y;} void Move(int x Off, int y Off) {_x+=x Off; _y+=y Off; } void Print( ) const { cout <<’(’ << _x << ’,’ << _y << ’)’<< end 1;} private: int _x,_y; }下列语句中会发生编译错误的是______。
A. Point pt; p Print();
B. const Point pt; p Print();
C. Point pt; p Move(1,2);
D. const Point pt; p Move(1,2);
[单项选择]有以下类定义: class MyClass { private: int id; char gender; char *phone; public: MyClass( ):id(0),gender(’#’),phone(NULL){} MyClass(int no,char ge=’#’,char *ph=NULL) {id=no;gender=ge;phone=ph; } };下列类对象定义语句中错误的是______。
A. MyClass myObj;
B. MyClass myObj(11,"13301111155");
C. MyClass my0bj(12,’m’);
D. MyClass myObj(12);
[单项选择]有如下类定义:
class Point
private:
static int how_many;
;
______how_many=0;
要初始化Point类的静态成员how_many,下画线处应填入的内容是______。
A. int
B. static int
C. int Point::
D. static int Point::
[单项选择]有以下类定义 class MyClass { private: int id; char gender; char*phone; public: MyClass( ):id(0),gender(’’#’’),phone(NULL){} MyClass(int no,char ge=’’#’’,char*ph=NULL) {id=no;gender=ge;phone=ph;} }; 下列类对象定义语句中错误的是【 】
A. MyClass myObj;
B. MyClass myObj(11,"13301111155");
C. MyClass myObj(12,’m’);
D. MyClass myObj(12);
[单项选择]有以下类定义
class MyClass

public:
MyClass( ) cout<<l;)

则执行语句MyClassa,b[2],*p[2];后,程序的输出结果是
A. 11
B. 111
C. 1111
D. 11111
[单项选择]

已知下列函数定义:
fun(int *b,int c,int n,int data)
int k;
for(k=0;k<m*n;k++)
*b=data;
b++;
则调用此函数的正确写法是(假设变量a的说明为int a[50])()。


A. fun(*a,4,5,1);
B. fun(&a,4,5,1);
C. fun((int*)a,4,5,1);
D. fun(a,4,5,1);
[填空题]有如下的函数定义:
int Xfun(int *a,int n)
int x *a;
for(int *pa=a+1;pa<a+n;pa++)
if(*pa>x)x=*pa;
return x;

若在执行了语句:
int x[5]=23,46,78,55,16;
后,通过表达式Xfun(x,5)调用该函数,则得到的返回值为______。
[单项选择]已知下列函数定义:
fun(int *b,int c,int d)
int k;
fbr(k=0;k<c*d;k++)
*b=c+d;
b++;

则调用此函数的正确写法是(假设变量a的说明为int a[10])______。
A. fun(*a,6,14);
B. fun(&a,6,8);
C. fun(a,8,4);
D. fun(int)a,8,6);
[单项选择]以下类定义中可能会引起错误的语句是(  )。   classA   {   public:   ~A(  ){}//1   inti;//2   private:   intj;//3   A(inti){i++;}//4   };
A. 1
B. 2
C. 3
D. 4
[填空题]#inelude<iostream.h>
class point
int x;
public:
void init(int a)x=a;
int getx( )return x;
void setx(int a)x=a;

void main( )
point a;
a.init(20,30);
cout<<a.getx( )<<endl;

[填空题]有如下的函数定义:
int Xfun(int x)
int y=x;
int x=10;y+=x;
return x+y;

通过表达式Xfun(5)调用该函数,则得到的返回值为______。
[单项选择]已知下列函数定义:
fun(int *b,int c,int d)
int k;
for(k=0;k<c*d;k++)
*b=c+d;
b++;

则调用此函数的正确写法是(假设变量a的说明为int a[10])()。
A. fun(*a,6,14);
B. fun(&a,6,8);
C. fun(a,8,4);
D. fun((int)a,8,6);
[单项选择]已知程序中已经定义了函数test,其原型是int test(int, int, int);,则下列重载形式中正确的是
A. char test(int,int,int);
B. double test(int,int,double);
C. int test(int,int,int=0);
D. float test(int,int,float=3.5F);
[单项选择]有如下类定义:
class AA

int a;
public:
int getRef( )const return &a; //①
int getValue( )const return a; //②
void set(int n)const a=n; //③
friend void show(AA a
A. const cout<<a;
[填空题]有如下定义:
class MA
int value:
public:
MA(int n=0):v;alut(n)

MA * ta,tb:
其中MA类的对象名标识符是______。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码