题目详情
当前位置:首页 > 计算机考试 > 初级程序员
题目详情:
发布时间:2024-01-11 06:43:50

[简答题]【说明】
在下面函数横线处填上适当的字句,使其输出结果为:
构造函数.
构造函数.
1,2
5,6
析构函数
析构函数.
【C++代码】
#include "iostream.h"
class AA
public;
AA(int i,int j)
A=i; B=j;
cout<<"构造函数./n";

~AA( ) (1) ;
void print( );
private:
int A, B;
;
void AA∷print( )
cout<<A<<","<<B<<endl;
void main( )

AA *a1, *a2;
(2) =new AA(1, 2);
a2=new AA(5, 6);
(3) ;
a2->print( );
(4) a1;
(5) a2;

更多"【说明】 在下面函数横线处填上适当的字句,使其输出结果为: 构造函"的相关试题:

[简答题]【说明】 在下面函数横线处填上适当的字句,使其输出结果为: 构造函数. 构造函数. 1,2 5,6 析构函数 析构函数. 【C++代码】 #include "iostream.h" class AA { public; AA(int i,int j) {A=i; B=j; cout<<"构造函数./n"; } ~AA( ){ (1) ;} void print( ); private: int A, B; }; void AA∷print( ) {cout<<A<<","<<B<<endl;} void main( ) { AA *a1, *a2; (2) =new AA(1, 2); a2=new AA(5, 6); (3) ; a2->print( ); (4) a1; (5) a2; }
[简答题]【说明】
在下面程序横线处填上适当的字句,3个(2)空填的是一样的。使其输出结果为:
x=5 x=6
y=7 x=8
z=9
【程序】
#include<iostream.h>
class X1
int x;
(1) ;
X1(int xx=0)x=xx;
(2) void Output( )
cout<<"x="<<x<<end;

;
(3) Y1:public X1
int y;
public:
Y1(int xx=0,int yy=0);X1(xx)y=yy;
(2) void Output( )
(4) Output( );
cout<<"y="<<y<<endl;

;
class Z1:public X1
int z:
(5) ;
Z1(int xx=0,int zz=0):X1(xx)(z=zz;
(2) void Output( )
X1∷Output( );
cout<<"z="<<z<<endl;

;
void main( )

X1 a(5);Y1 b(6,7);Z1 c(8,9);
X1*p[3]=&a,&b,&c);
For(int i=0;i<3;i++)
p[i]->Output( );cout<<endl;


[填空题]在下面函数的横线处填上适当的内容使该函数能够利用递归方法求解字符串str的长度(不得使用系统提供的字符串处理函数)。 int GetLen(char *str { if ( 【6】 ) return 【17】 ; else return 1+GetLen (str+1); }
[填空题]在下面函数的画线处填上适当的内容,使该函数能够利用递归方法求解字符串str的长度(不得使用系统提供的字符串处理函数)。
int GetLen(char*str)
if( (6) )return (7)
else return 1+GetLen(str+1);


[填空题]在下面横线上填上适当的语句,完成程序。 #include <iostream> using namespace std; class Base { int x: public: Base (int i){x=i;} ~Base( ){} }; class Derived : public Base { public: ______ //完成类Derive构造函数的定义 }; int main ( { Derived Obi; return 0; } 在横线外应填入的语句是______。
[填空题]在下面横线上填上适当的语句,完成程序。 #include <iostream> using namespace std; class Base { int x; public: Base(int i) { x=i;} ~Base( ){} }; class Derived: public Base { public: ______∥完成类 Derive构造函数的定义 }; int main( ) { Derived Obj; return 0; } 在横线处应填入的语句是 【9】
[填空题]在下面横线上填上适当的语句,完成程序。
#include <iostream>
using namespace std;
class Base

int x;
public:
Base(int i) x=i;
~Base( )
;
class Derived: public Base

public:
______∥完成类 Derive 构造函数的定义
;
int main( )

Derived Obj;
return 0;

在横线处应填入的语句是 【11】
[填空题]在下面横线上填上适当的语句,完成程序。
#include <iostream>
using namespace std;
class Base

int x:
public:
Base (int i)x=i;
~Base( )
;
class Derived : public Base

public:
______ //完成类Derive构造函数的定义
;
int main (

Derived Obi;
return 0;

在横线外应填入的语句是______。
[填空题]在下面横线上填上适当的语句,完成程序。
#include<iostream>
using namespace std;
class Base

int x;
public:
Base(int i)x=i;
~Base( )

class Derived:public Base

public:
【10】 完成类Derive构造函数的定义

int main( )

Derived Obj;
return 0;

[填空题]在下面横线上填上适当的语句,完成程序。
#include <iostream>
using namespace std;
class Base

int x;
public:
Base(int i) x=i;
~Base( )
;
class Derived : public Base

public:
______//完成类Derive构造函数的定义
;
int main( )

Derived Obj;
return 0;

在横线处应填入的语句是______。
[填空题]在下面横线上填上适当的语句,完成程序。 #include<iostream> using namespace std; class Base { int x; public: Base(int 0{x=i;} ~Base( ){} }; class Derived:public Base { public: //完成类Derive构造函数的定义 }; int main( ) { Derived Obj; return 0; }

我来回答:

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

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码