填空题有以下程序:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int main()
{
fstream filel,file2;
char line[100];
filel.open("source.txt",ios::in);
if(!file1)
{
cout<<"Can't open file source.txt!"<<end1;
abort();
}
file2.open("dest.txt",ios::out);
if(!file2)
{
cout<<"Can't open file dest.txt!"<<end1;
abort();
}
while(!file1.eof())
{
filel.getline(1ine,100);
file2<<line;
file2<<end1;
}
filel.close();
file2.close();
return 0;
}
此程序实现的功能是{{U}} 【15】 {{/U}}。
填空题下面程序的输出结果是 【8】 。 #include<iostream> using namespace std; int x; void funA(int&,int); void funB(int,int&); int main() int first; int second=5; x=6; funA(first,seconD) ; fimB(first,seconD) ; cout<<first<<" "<<second<<" "<<x<<end1; return 0; void funA(int &a,int B) int first; first=a+b; a=2*b; b=first+4; void funB(int u,int &v) int second; second=x; v=second+4; x=u+v;
填空题请定义一个函数名为A,返回值为int,没有参数的纯虚函数,该定义是______。
填空题若有定义语句:int*a,b;,则变量b的数据类型是 【6】 。
填空题通过关键字来指定函数模板的类型参数,有几个类型参数就有几个关键字,它实际表示任何内部类型或用户自定义类型。用来指定函数模板的类型参数的关键字是 【14】 。
填空题构造函数是和【 】同名的函数。
填空题有以下程序:
#include <iostream>
using namespace std;
class Base
{
int a;
public:
Base(int x) { a-x; }
void show() { cout<<a; }
};
class Derived : public Base
{
int b;
public:
Derived(int i) :Base(i+1)
void show() { cout<<b; }
};
int main ( )
{
Base b(5) ,*pb;
Derived d(1);
pb=
pb->show ();
return 0;
}
运行后的打印结果是{{U}} 【14】 {{/U}}。
填空题将关键字const写在函数头之后,函数体之前,说明该函数是一个const成员函数。此时const不是指定函数的返回值,而是修饰______指针。
填空题有以下程序: #include <iostream> using namespace std; int main() int m[5],n[5],*px,*py,k; px=m; py=n; for(k=1;k<4;k++) *px=k; *py=2*k; cout<<m[k-1]<<n[k-1]; px++;py++; cout<<end1; return 0; 运行后的输出结果为 【8】 。
填空题有如下程序: #include <iostream> using namespace std; class PARENT public: PARENTO cout<<"PARENT"; ; class SON : public PARENT public: SON() cout<<"SON"; ; int main() SON son; PARENT *p; p= return 0; 执行上面程序的输出是______。
填空题下面是一个栈类的模板,其中push函数将元素i压入栈顶,pop函数弹出栈顶元素。栈初始为空,top值为0,栈顶元素在stack[top-1]中,在下面横线处填上适当的语句,完成栈类模板的定义。 template<class t> class Tstack enumsize=1000; T stack[size] int top; public: Tsack():top(0) void push(const T T pop() if(top==O)exit(1);//栈空时终止运行 retum 【15】 ; ;
填空题写出下列程序的运行结果。 #include<iostream. h> class X public: virtual void disp()cout<<”X类的disp函数<<”end1; ; class Y:public X public: void disp()cout<<”Y类的disp函数<<”end1; ; void main() X a, *p= p->disp(); p=&b; p->disp(); 运行结果为: [14] [15]
填空题C++语言程序由函数构成,其至少包含一个函数,这就是 【9】 。
填空题组成C++语言的基本符号包括:字母、数字和 【6】 。
填空题请分析下面的程序并给出该程序的执行结果 [13] 。 #include <iostream> class AA int a; public: AA() cout<<" Initializing AA!/n" ; AAM() cout<<" Destroying AA!/n" ; ; class BB int b; AA p; public: BB() cout<<"Initializing BB!/n" ; ~BB() cout<<"Destroying BB!/n" ; ; void main() BB X; cout<<"Ending main!/n' ;
填空题执行语句序列: int x=10, cout<<x<<'-'<<r<<end1;输出结果为 【8】 。
填空题虚基类是含有{{U}} 【13】 {{/U}}函数的类。
填空题通过使用new和delete两个运算符进行的分配为 【9】 存储分配。
填空题如果一个函数在其函数体内直接或间接地调用自己,则该函数称为__________函数。
填空题在数据库逻辑结构的设计中,将ER模型转换为关系模型应遵循相关原则。对于三个不同实体集和它们之间的多对多联系m:n:p,最少可转换为{{U}} 【5】 {{/U}}个关系模式。
