填空题下面程序的输出结果为{{U}} 【8】 {{/U}}。
# include <iostream.h>
void main( )
{
int num=0,i=8;
do {
i --;
num++;
} while(--i);
cout << num << endl;
}
填空题定义类对象时自动调用 【9】 为类对象中的数据成员赋初值。
填空题以下程序运行后的输出结果是{{U}} [10] {{/U}}。
#include<iostream.h>
void main(){
char s[]=“123456”,*p;
for(p=s; p<s+2; p++)
cout<<p<<end1;
}
填空题标识虚函数的关键字是______。
填空题若以非成员函数形式,为类Bounce重载“!”运算符,其操作结果为一bool型数据,则该运算符重载函数的原型是______。
填空题以下程序的输出是 【8】 。 #include<iostream> using namespace std; fun(intm) static int n=1; n=m*n; return(n); void main() int i; for(i=1;i<=3;i++) cout<<fun(i);
填空题一个结构占用的空间理论上等于{{U}} 【10】 {{/U}}。
填空题以下程序的执行结果是______。
#include<iostream.h>
class Sample
{
int n;
public:
Sample(){}
Sample(int m){n+m;)
int&operator--(int)
{
n--
return n;
}
void disp () {cout<<"n= "<<n<<end1;}
}
void main ()
{
Sample s (10);
(s--) ++;
s.disp();
}
填空题C++语言提供的“::”运算符的作用是在同名局部变量的作用域中访问{{U}} 【8】 {{/U}}。
填空题二叉树由三个基本单元组成,即左子树,右子树和{{U}} 【4】 {{/U}}。
填空题按“先进先出”原则组织数据的数据结构是{{U}} 【3】 {{/U}}。
填空题下列程序的执行结果为 【15】 。 #include<iostream.h> void main() cout.fill(‘*’); cout.width(10); tout <<"hello"<<end1;
填空题如果类中的一个成员函数的定义实现在类内,则该函数系统自动默认为该类的{{U}} 【9】 {{/U}}函数。
填空题以下程序的执行结果为______。 #include<iostream.h> class A public:A()cout<<“a”; ~A()cout<<“b”;; class B:public A public: B()cout<<“c”;) ~B()cout<<“d”;; void main() B b;
填空题高度为h(h>0)的二叉树最少有 [3] 个结点。
填空题下列程序的运行结果是______。 #include<iostream.h> class A public: virtual void use()cout<<"in A/n";; class B:public A public: virtual void use()cout<<"in B/n";; class C:public B public: virtual void use()cout<<"in C/n";; void main() A *obj; obj=new C; obj—>use(); delete obj;
填空题在下面横线上填上适当的语句,完成程序。
#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;
}
填空题数据结构分为逻辑结构与存储结构,线性链表属于 。
填空题类中包含了一个静态成员函数,则main函数中和P. f1 (P); 语句具有同样功能的语句为{{U}} 【11】 {{/U}}。
#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<<endl;
cout<<"B="<<m. B<<endl;
}
int M: :B=10,
void main( )
{
M P(5);
P. f1(P);
}
填空题假定w、x、y、z、m均为血型变量,有如下程序段: w=1;x=2;y=3;z=4; m=(W<X)?w:X; m=(m<y)?m:y; m=(m<z)?m:z; 则该程序运行后,m的值是 【6】 。