填空题假定Xcs是一个类,该类中一个成员函数的原型为“Xcs* abc;”,则在类外定义时对应的函数头为______。
填空题在下面横线上填上适当的语句,完成程序。#include<iostream>using namespace std;class Base int x;public: Base(int i) x=i; ~Base() ;class Derived: public Basepublic: 【14】 //完成类Derive 构造函数的定义;int main() Derived Obj(); return 0;
填空题下列程序中需要清理动态分配的数组,划线处应有的语句是{{U}} 【13】 {{/U}}。
#include<iostream, h>
class person
{
int age, tall;
public:
person() { age= 0; tall= 40; cout<<"A baby is born. "<<end1;}
person(int i) {age=i, tall=40, cout<<"A old person. "<<end1;}
person(int i, int i) { age = i; tall = j; cout <<" a old person with tall. "<<
end1;}
~person( ) {cout<<" person dead. "<<end 1;}
void show()
{
cout<<"age= "<<age<<" ,tall= "<<tall<<end1;
}
};
void main()
{
person * ptr;
ptr = new person[3];
ptr[0]=person ( )
ptr[1]=person(18);
ptr[2]=person(20,120);
for(int i=0;i<3; i++)
ptr[i]. show( );
______
}
填空题在面向对象方法中,信息隐蔽是通过对象的 【1】 来实现的。
填空题以下程序的执行结果是 ______。
#include<iostream.h>
void main()
{
cout.filll('*');
cout.width(10);
cout<<123.45<<endl:
cout.width(8);
cout<<123.45<<endl;
cout.width(4);
cout<<123.45<<endl;
}
填空题在内存中,存储字符'X'要占用1个字节,存储字符串"X"要占用______个字节。
填空题数据的基本单位是______。
填空题如果表达式x=y*z中的“*”是作为成员函数重的运算符,采用运算符函数调用格式,该表达式还可以表示为 【10】 。
填空题强行排错法涉及的调试技术主要是 【4】 和监视表达式。
填空题有如下定义: Class MA int value; public: MA(int n=0):value(n) ; MA*ta,tb; 其中MA类的对象名标识符是______。
填空题如果一个班主任可管理多个班级,而一个班级只被一个班主任管理,则实体“班主任”与实体“班级”之间存在______联系。
填空题下面是“二维向量”vector2D的定义,其中作为成员函数重载的运算符“+”的功能是将两向量的分量x和y对应相加,然后返回作为相加结果的新对象;请填空补充完整。
class vector2D{
double x; //x分量
double y; //y分量
public:
vector2D(double x0=0,double y0=0):x(x0),y(y0){}
void show(cout<<'('<<','<<y<<')';}
vector2D operator+(vector2D) ;
};
{{U}} 【11】 {{/U}}operator + (vector2D A)
{
return vector2D({{U}} 【12】 {{/U}});
}
填空题下面程序的结果{{U}} [13] {{/U}}。
#include<iostream.h>
int f(int);
void main() {
int x=1, i;
for (i=0; i<3; i++)
cout<<f(x)<<‘ ’ ;
cout<<end1;
}
int f(int x){
int y=1;
static int z=3
y++;
z++;
return (x+y+z);
}
填空题下列程序的输出结果为 【13】 。#include <iostream. h>void main() char a[]="abcdabcabfgacd"; int i1=0,i2=0,i=0; while (a[i]) if (a[i]=='a') i1++; if (a[i]=='q') i2++; i++; cout<<i1<<''<<i2<<end1;
填空题下列程序的输出结果为{{U}} {{U}} {{/U}} {{/U}}。
#include <iostream. h>
void main()
{
char a[]="abcdabcabfgacd";
int i1=0,i2=0,i=0;
while (a[i])
{
if (a[i]=='a') i1++;
if (a[i]=='q') i2++;
i++;
}
cout<<i1<<''<<i2<<end1;
}
填空题下面程序运行输出的结果是{{U}} 【9】 {{/U}}。
#include <iostream>
using namespace std;
int main(){
char a[]="Chinese";
a[3]='/0';
cout<<a<<endl;
return 0;
}
填空题16位计算机中整型占{{U}} 【12】 {{/U}}个字节存储空间。
填空题某二叉树中度为2的结点有18个,则该二叉树有______个叶子结点。
填空题完全不考虑程序的内部结构和内容特征的是{{U}} 【4】 {{/U}}测试方法。
填空题每个对象都维护了一个指向自身的指针,这个指针称为 [12] 指针