填空题哈夫曼树是{{U}} 【5】 {{/U}}。
填空题利用成员函数对双目运算符重载,其左操作数为______,右操作数为______。
填空题请将下列类定义补充完整。 class Basepublic:void fun()cout<<"Base∷fun"<<end1;; c1ass DehVed:public Base public: void fun() ______ ∥显式调用基类的fun函数 cout<<"Derived∷fun"<<endl; ;
填空题下列程序的输出结果是{{U}} 【9】 {{/U}}。
#include<iostream>
#include<cstring>
using namespace std;
void fun(const char*s,char }
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str, ch);
cout<<ch;
return 0;
填空题若要作为类A的成员函数重载前置“++”运算符,使其作用于类A的对象,则该运算符函数的声明部分应该是______。
填空题下面是复数类complex的定义,其中作为友元函数重载的运算符“--”的功能是将参数对象的实部减1,然后返回对该对象的引用;请补充完整。
class complex
{
private:
int real;
int imag;
public:
complex(int r=0,int i=0):real(r),imag(i){}
void show()
{
cout((real<<(imag<0?”-”:”+”)<(imag<<‘i’;
}
______;
};
complex& operator--(complex &c)
{
c.real--;
return C;
}
填空题在C++类的规定中:静态函数只能给引用类的静态成员和{{U}} 【11】 {{/U}}。
填空题一棵二叉树中序遍历结果是ABCDEFG,前序遍历结果是DBACFEG,则后序遍历结果为______。
填空题以下程序的运行结果是{{U}} 【10】 {{/U}}。
#include<iostream>
#include<string>
using namespace std;
void main(){
chara[10]="China",b[]="Chin",c[]="ese";
cout<<strlen(strcat(strcpy(a,b),c))<<endl;
}
填空题将一个函数声明为一个类的友元函数必须使用关键字 【9】 。
填空题operator是运算符重载时必须使用的关键字,它和被重载的运算符连在一起,作为运算符函数的专用函数名,务必把该函数说明为 【11】 的。
填空题有如下程序:
#include<iostream>
using namespace std;
class Sac{
int n;
public:
Sac():n(4){cout<<n;}
Sac(int k):n(k){cout<<n;}
~Sac(){cont<<n+n;}
};
int main(){
Sac s1,*s2;
s2=new Sac(3);
delete s2;
return 0;
}
运行时的输出结果是______。
填空题C++中类作用域符是{{U}} 【6】 {{/U}}。
填空题以下程序的执行结果为{{U}} {{U}} {{/U}} {{/U}}。
#include<iostream>
using namespace std;
void overload(int num)
{
cout<<num<<end1;
}
void overload(char ch)
{
char c=ch+1;
cout<<c<<end1;
}
int main()
{
overload('X');
return 0;
}
填空题有如下类声明: class MyClass int i; private:int j; protected: int k; public: int m, n; 其中,私有成员的数量为 【15】 。
填空题假设int a=1,b=2;则表达式a+++--b的值为【 】。
填空题软件工程包括三个要素,分别为方法、工具和 【4】 。
填空题内联函数是通过 【6】 来实现的,因此内联函数是真正的函数。
填空题在C++中的实型数据分为三种类型,即单精度float、双精度double和{{U}} 【8】 {{/U}}。
填空题类中包含了一个静态成员函数,则main函数中和P.f1(P);语句具有同样功能的语句为______。
#include<iostream.h>
class M
{public:
M(int A){A=a;B+=a;}
static void f1(M m);
private:
int A;
static int B;};
void M::f1(M m)
{
cout<<“A=“<<m.A((end1;
cout<<“B=”<<m.B<<end1;
}
int M::B=10;
void main()
{
M P(5);
P.f1(P);
}