填空题下列程序的输出结果是______。
#include<iostream>
using namespace std;
class Test{
public:
Test(){cnt++;}
~Test(){cnt--;}
static int Count(){return cnt;}
private:
static int cnt;
};
int Test::cnt=0;
int main()
{
cout<<Test::Count()<<"";
Test t1,t2;
Test *pT3=new Test;
Test *pT4=new Test;
eout<<Test::Count()<<"";
delete pT4;
delete pT3;
cout<<Test::Count()<<endl;
return 0;
}
填空题若已知a=10,b=20,则表达式!a=______。
填空题已知程序的结果为123,请填空。
#include<iostream.h>
template<classT>
classA
{
public:
Tx,y,z;
voiddisplay( ){cout<<x<<""<<y<<""<<z;}
};
voidmain( )
{
A<int>al;
{{U}} 【12】 {{/U}}
{{U}} 【13】 {{/U}}
{{U}} 【14】 {{/U}}
al.display( );
}
填空题将x=y*z中的“+”用成员函数重载,“*”用友元函数重载应写为______。
填空题在下面的程序的横线处填上适当的语句,使该程序的输出结果为12。
#include<iostream>
using namespace std;
class TestClass
{
public:
int a,b;
TestClass(int i,int j)
{
a=i;
b=j;
}
};
class TestClass1:public TestClass
{
int a;
public:
TestClass1(int x):TestClass(x,x+1){}
void show()
{
______;∥输出基类数据成员a的值?
cout<<b<<endl;
}
};
int main()
{
TestClass1 d(1);
d.show();
return 0;
}
填空题以下程序运行后的输出结果是
________
。
#include<iostream.h>
void main(){
char s[]=“123456”,*p;
for(p=s; p<s+2; p++)
cout<<p<<end1;
}
填空题______ 使一个函数可以定义成对许多不同数据类型完成同一个任务。
填空题一个队列的初始状态为空。现将元素A,B,C,D,E,F,5,4,3,2,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 Obj; return 0; 在横线处应填入的语句是 【11】 。
填空题数据结构分为逻辑结构和存储结构,循环队列属于工{{U}} 【5】 {{/U}}结构。
填空题完成下列类的构造函数,初始化语句为 【13】 。#include <iostream. h>class Testprivate: int x, y;public, void Test(int initx, int inity) ______ void printx() cout<<x<<"—"<<y<<"="<<x-y;;void main() Test x(300, 200); x. printx();
填空题从一个或多个基本表导出的表是一个{{U}} 【5】 {{/U}},它是一个虚表。
填空题为了克服软件危机提出了 【3】 概念。
填空题下列程序运行后的输出结果是{{U}} 【15】 {{/U}}。
#include<iostream.h>
void fun(int,int,int *);
void main()
{
int x,y,z;
fun(5,6,
fun(7,x,
fun(x,y,
cout<<x<<","<<y<<","<<z<<endl;
}
void fun(int a,int b,int *c)
{
b+=a;
*c=b-a;
}
填空题如果要把viod fun()定义为类X的友元函数:则应在类X的定义中加入语句 [11] 。
填空题C++语句const char*const p="hello";,所定义的指针p和它所指的内容都不能被 【10】 。
填空题C++语言的参数传递机制包括传值和传地址两种,如果调用函数时,需要改变实参或者返回多个值,应该采取 方式。
填空题重载的流运算符函数经常定义为类的 【7】 函数。
填空题如果表达式x=y*z中的“*”是作为成员函数重的运算符,采用运算符函数调用格式,该表达式还可以表示为{{U}} 【10】 {{/U}}。
填空题软件测试可分为白盒测试和黑盒测试。基本路径测试属于______测试。
