填空题表达式x. operator++( ) 还可写成
______
。
填空题逻辑表达式x>3 && x<10的相反表达式为 【6】 。
填空题以下程序的输出结果是______。 #include<iostream.h> void main() { int a=0; a+=(a=8); cout<<a; }
填空题在下面的类定义中,this指针的用途是______。 #included<iostream.h> class Sample int x,y; public: Sample(int i,int j)x=i;y=j; void assign(Sample sa); ; void Sample::assign(Sample p) if(this!=&p) x=p.x; y=p.y;
填空题表达式x.operator+(y.operator++(0))还可以写成 【13】 。
填空题若有以下程序: #include <iostream> using namespace std; class Base public: void who() cout<<"class Base"<<end1; ; class Derivedl : public Base public: void who() cout<<"class Derivedl"<<end1; ; class Derived2 : public Base public: void who() cout<<"class Derived2"<<end1; ; int main() Base *p; Derivedl obj1; Derived2 obi2; p= p= p->who ( ); return 0; 则该程序运行后的输出结果是 【14】 。
填空题C++编译时的多态性体现在______,运行时的多态性体现在______。
填空题在下面函数的横线处填上适当的内容,使该函数能够利用递归方法求解字符串str的长度(不得使用系统提供的字符串处理函数)。 int GetLen(char*str) if(______) return 0; else return 1+GetLen(str+1);
填空题数据模型分为格式化模型和非格式化模型,则关系模型属于
________
模型。
填空题若执行下面程序段后的输出为:345,请填空。 int a,b=3,c=5; a=b<c? 【7】 :c++; cout<<a<<b<<c;
填空题在类的对象被创建的时候,{{U}} 【9】 {{/U}}函数会被自动调用。
填空题C++中的模板分为函数模板和__【15】____。
填空题在执行语句序列
int i=0; do i++; while(i*i<10);
时,do后面的循环体语句i++被执行的次数为 【7】 。
填空题有如下程序:
#include<iostream>
using namespace std;
class A{
public:
A(){cout<<"A";}
~A(){cout<<"A";}
};
class B{
Aa;
public:
B(){cout<<"B";}
~B(){cout<<"B";}
};
int main(){
B b;
return 0:
}
程序的输出结果是______。
填空题下面程序是一个堆栈的类模板,在横线处填上适当语句,完成类模板的定义。
#define MAXSIZE 100
template <class T>
class Stack
{
T s[MAXSIZE];
int top;
public:
stack()
{
top=1;
}
void push(T newValue)
{
if(top<MAXSIZE)
{
top=top+1;
s[top]=newValue;
}
else
cout<<"堆栈满,无法进栈"<<end1;
}
void pop();
};
{{U}} 【12】 {{/U}}
{
if(top>1)
{
cout<<s[top]<<end1;
top=top-1;
}
else
cout<<"堆栈空! "<<end1;
}
填空题在面向对象方法中,信息隐蔽是通过对象的
________
来实现的。
填空题为解决在多重继承环境中因公共基类带来的 【10】 问题,C++语言提供了虚基类机制。
填空题下列程序的运行结果是 【12】 。# include<iostream. h>class Apublic: virtual void use()cout << "in A/n"; ;class B:public Apublic: virtual void use()cout << "in B/n";;class C: public Bpublic: virtual void use() cout<< "in C/n"; ; void main() A *obj; obi=new C; obj->use() delete obj;
填空题在算法正确的前提下,评价一个算法的两个标准是
________
。
填空题下面程序的运行结果为{{U}} 【10】 {{/U}}。
# include <iostream.h>
void fun(int x=0,int y=0)
{
cout << X << y;
}
void main( )
{
fun(5);
}
