填空题一个模块直接调用的其他模块的个数称为______。
填空题有一种特殊的虚函数,重定义时不要求同名,这种虚函数是{{U}} 【11】 {{/U}}。
填空题在声明派生类时,如果不显式地给出继承方式,那么默认的类继承方式是私有继承prirate。已知有如下类定义: class Base protected: void fun( ) ; Class Derived:Base; 则Base类中的成员函数fun( )在Derived类中的访问权限是______(注意:要求填写private、protected或public中的一项)。
填空题有以下程序 #include <iostream> using namespace std; class MyClass public: static int s; MyClass(); void SetValue(int val); ; int MyClass::s=0; MyClass::MyClass() s++; ) void MyClass::SetValue(int val) s=val; int main() MyClass my[3],*p; p=my; for(int k=0;k<3;k++) p->SetValue(k+1); p++; cout<<MyClass::s<<endl; return 0; 运行后的输出结果是______。
填空题如果一个模板声明时有类型形参表,则多个参数之间必须使用_______隔开,每个参数都必须重复使用关键字______。
填空题有如下程序:
#include <iostream>
using namespace std;
class ONE
{
public:
virtual void f() { cout << "1"; }
};
class TWO: public ONE
{
public:
TWO() { cout << "2"; }
};
class THREE: public TWO
{
public:
virtual void f() {TWO::f(); cout << "3"; }
};
int main()
{
ONE aa, *p;
TWO bb;
THREE cc;
p=
P->f();
return 0;
}
执行上面程序的输出是{{U}} 【11】 {{/U}}。
填空题使用VC6打开考生文件夹下的工程test20_1,此工程包含一个源程序文件test21_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: (1,2) 5,6 (6,9) 源程序文件test20_1.cpp清单如下: #include<iostream.h> class A public: A(int i,int j) a=i; b=j; /**************** found *******************/ void Move( int x, iht y) a+=x;b+=y void Show() cout <<"("<<a<<","<<b<<")"<<end1; private : int a,b; ; class B:private A public: /**************** found *******************/ B(int i,int j,int k, int 1): (i,j) x=k;y=1; void Show () cout<<x<<", "<<y<<end1; void fun() Move(3,5); /**************** found *******************/ void f1() Show(); private: int x,y; ; void main () A e(1,2); e. Show ( ); B d(3,4,5,6); d. fun(); d. Show ( ); d.f1();
填空题为了使模块尽可能独立,要求模块的内聚程度要尽量高,且各模块间的耦合程度要尽量{{U}} 【3】 {{/U}}。
填空题下面程序的功能是:将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变。请填空。 #include<iostream.h> #include<string.h> main() char a[]="clanguage",t; //一定是偶数个数 int i,j,k; k=strlen(a); for(i=0;i<=k-2;i+=2) for(j=i+2;j<=k; j=j+2) if( 【15】 ) t=a[i];a[i]=a[j];a[j]=t; cout<<a<<endl;
填空题以下程序运行后的输出结果是_________。
int f(int a[],int n)
{ if(n>=1) return f(a,n-1)+a[n-1];
else return 0;
}
main()
{ int aa[5]={1,2,3,4,5},s;
s=f(aa,5); printf("%d/n",s);
}
填空题若有:
int a=10,b=9,c;
则在计算表达式c=(a%11)+(b=3),c+=2后,变量c的值为{{U}} [6] {{/U}}。
填空题数据库管理系统常见的数据模型有层次模型、网状模型和{{U}} 【3】 {{/U}}三种。
填空题 【13】 允许用户为类定义一种模式,使得类中的某些数据成员及某些成员函数的返回位能取任意类型。
填空题下列程序的输出结果为012,请根据注翻译将横线处的缺失部分补充完整。 #include<iostream> using namespace std; class Test public; Test(int a)data=a; ~Test() void print()(cout<<data; private; int data; ; int main() Test t[3]=______;//对有3个元素的Test类对象数组t初始化 for(int i=0;i<3;i++)t[i].print(); return 0;
填空题数组的下标是从 【6】 开始的。
填空题以下程序的功能是输出1至100之间每位数的乘积大于每位数的和的数,例如对于数字 12,有1*2<1+2,故不输出该数;对于27,有2*7>2+7,故输出该数。请填空。
#include<iostream.h>
void main()
{
int n,k=1,s=o,m:
for (n=l:n<=100;n++=
{
k=l;s=0;
______;
while(______)
{
k*=m%10;s+=m%10;
________
;
}
if(k>s)cout<<n;
}
}
填空题以下程序的执行结果为{{U}} 【8】 {{/U}}。
#include<iostream>
using namespace std;
class base
{
public:
virtual void who( )
{
cout < < "base class" < <end1;
};
class derivel:public base
{
public:
void who( )
{
cout < <"derivel class" < <end1;
};
}
class derive2:public base
{
public:
void who( )
{
cout< <"derive2 class"< <end1;
}
};
void main( )
{
base obj1,* p;
derivel obi2;
derive2 obj3;
p=&obj1;
p->who( );
p=&obj2;
p->who( );
p=&obj3;
p->who( );
}
填空题使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并使程序输出的结果为 TC1 TC2 注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。 试题程序: #include<iostream.h> #include<assert.h> struct TC0 //********error******** virtual void fun(); ; class TC1:public TC0 void fun() cout<<"TC1"<<end1; ; class TC2:public TC0 void fun() cout<<"TC2"<<end1; ; void main() TC0 *p; TCl obj1; TC2 obj2; //********error******** p=*obj1; p—>fun(); //********error******** p=*obj2; p—>fun(); return;
填空题在C++的面向对象程序设计框架中, 【6】 是程序的基本组成单元。
填空题有如下的程序:
#include<iostream>
#include<fstream>
using namespace std;
int main() {
char s[25]="Programming language";
ofstream f1(DATA.TXT");
f1<<"C++ Programming";
f1.close();
ifstream f2 ("DATA.TXT");
if(f2.good())f2>>s;
f2. close();
cout<<s;
return 0;
}
执行上面的程序交输出{{U}} 【9】 {{/U}}。
