填空题下面程序的输出结果为 【8】 。 #include<iostream.h> void main( ) int num=0,i=8; do i--; num ++; while(--i); cout<<num<<end1;
填空题以下程序的输出结果是【 】。
#include<iostream.h>
voidfun( )
{ staticinta=0;
a+=2;
cout<<a<<"";}
voidmain( )
{ intcc;
for(cc=1;cc<4;cc++)
fun( );
cout<<endl;}
填空题在创建对象时系统自动调用的函数是 【9】 。
填空题已知__--X树中序遍历序列是cbade,它的后序遍历序列是cbeda,前序遍历序列是 【3】 。
填空题写出执行完下列代码段之后指定变量的值:
boo1 x=true,y=false,z=false;
x=x
y=x‖y
z=!(x!=y)‖(y==z),
则 x=false, y=false, z={{U}} 【6】 {{/U}}。
填空题下面是复数类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';
}
{{U}} 【15】 {{/U}};
};
complex& operator--(complex &C)
{
c.real--;
return c;
}
填空题友元类的所有成员函数都是另一个类的 【10】 。
填空题定义在类内部的函数被类默认为______,在类外部每次调用该函数时,定义的函数代码会在调用函数位置展开。
填空题执行”cout<<char('A'+2)<<endl;”语句后得到的输出结果为______。
填空题多继承情况下,派生类对基类成员的访问会出现二义性。解决二义性的方法是{{U}} {{U}} {{/U}} {{/U}}、 {{U}} {{U}} {{/U}} {{/U}}和{{U}} {{U}} {{/U}} {{/U}}。
填空题假设a、b均是整型变量,则表达式a=2,b=5,a++,b++,a+b值为{{U}} 【6】 {{/U}}。
填空题语句cout<<setprecision(3)<<3.1415926<<endl;的输出为______。
填空题执行以下程序后,输出结果第二行的内容是______。 #include<iostream> using namespace std; class TestClass public: virtual void who()cout<<"Base Class"<<endl; ; class TestClass1:public TestClass public: virtual void who()cout<<"TestClass1 Class"<<endl; ; class TestClass2:public TestClass public: virtual void who()cout<<"TestClass2 Class"<<endl; ; int main(int argc,char*argv[]) TestClass obj1,*p; TestClass1 obj2; TestClass2 obj3; P=p->who(); p=p->who(); p=p->who(); return 0:
填空题测试的目的是暴露错误,评价程序的可靠性;而发现错误的位置并改正错误的是{{U}} 【1】 {{/U}}。
填空题请在如下程序中的空格处填写正确的语句:
#include
using namespace std;
class Base{
public:
void fun(){cout<<”Base fun”<
填空题对虚函数的调用有两种方式: 【11】 和 【12】 。
填空题执行以下程序后,输出“#”号的个数是______。 #include <iostream.h> main() inti,j; for(i=1;i<5;i++) for(j=2;j<=i;j++) cout<'#';
填空题下列程序的输出结果是______。
#include<iostream>
using namespace std;
class base
{
public:
int n;
base(int x){n=x;}
virtual void set(int m){n=m;cout<<n<<'';}
};
class deriveA:public base
{
public:
deriveA(int x):base(x){}
void set(int m){n+=m;cout<<n<<'';}
};
class deriveB:public base
{
public:
deriveB(int x):base(x){}
void set(int m){n+=m;cout<<n<<'';}
};
int main( )
{
deriveA d1(1);
deriveB.d2(3);
base*pbase;
pbase=
pbase->set(1);
pbase=
pbase->set(2);
return 0;
}
填空题具有相同函数名不同参数表的函数称为 【6】 。
填空题用于输出表达式值的标准输出流对象是 【1】 ,用于从键盘上为变量输入值的标准输入流对象是 【2】 。