填空题下列程序不能通过编译,应该在划线部分填写的语句是{{U}} 【9】 {{/U}}。
#include<iostream. h>
#include<stdlib. h>
double Fune(int a, int b, char ch)
{
double x;
switch(ch)
{
case '+':
x=double(a) +b;
break;
case '--':
x= double(a) --b;
break;
case '/':
x=double(a) * b;
break;
case '/':
if(B) x=double(a) /b;
else
exit(1)
break
default:
exit(1);
}
______
}
void main()
{
cout<<Func(32 , 6 ,'--')<< ",";
cout<<Func(32, 6 ,'*') <<",";
cout<<Func(32, 6 ,'/') <<end1;
}
填空题假设用一长度为50的数组(数组元素的下标从0到49)作为栈的存储空间,栈底指针bottom指向栈底元素,栈顶指针top指向栈顶元素,如果bottom=49,top=30(数组下标),则栈中具有______个元素。
填空题在数据库应用系统设计的需求分析阶段,需经过收集资料、分析整理、{{U}} 【5】 {{/U}}、建立数据字典和用户确认等阶段。
填空题派生类中所定义的虚函数的 [12] 不影响对它的动态联编,即基类中已定义的虚函数,其同名函数放在派生类中的 [13] ,都可以实现运行时多态性。
填空题下列程序的运行结果为 【14】 。 #include <iostream. h> class myclass private: int a, b, c; public: void fun() int a; a=10; this->,a=5; b=6; this->c=7; cout<<"a="<<a<<",this->a="<<this->a<<endl; ; void main() myclass obj1; obj1.fun()
填空题数据的基本单位是 【2】 。
填空题{{U}} 【4】 {{/U}}是数据库设计的核心。
填空题有如下定义语句:
MyClass*p[10];
当类对象数组指针p离开它的作用域时,系统自动调用析构函数{{U}} 【10】 {{/U}}次。
填空题类ostream的成员函数 【10】 用于执行无格式输出,成员函数put用于输出单个字符。
填空题已知程序的结果为1 2 3,请填空。
#include<iostream.h>
template<class T>
class A
{
public:
T x,y,Z;
void display( ) {cout << x << " " << y << " " << z;}
};
void main( )
{
A<int>a1;
_________
_________
_________
a1.display( );
}
填空题多态性具体体现运行和编译两个方面,在程序运行时的多态性通过继承和______来体现,而程序编译时多态性体现函数和运符的重载上。
填空题以下程序的执行结果是______。 #include<iostream.h> class A int a; public: void seta(int x) a=x; void showa() cout<<a<<endl; ; class B int b; public: void setb(int x) b=x; void showb() cout<<b<<endl: ; class C:public A,private B private: int c; public: voidsetc (intx,inty,intz) c=z; seta(x); setb(y); void showc()cout<<c<<endl; ; void main() Cc; C.seta(1); C.showa(); C.setc(1,2,3); C.showc();
填空题以下程序的执行结果是 ______。
#include<iostream.h>
int &max(int &x,int &y)
{
return(x>y? x:y);
}
void main()
{
int n=2,m=10;
max(n,m)--;
cout<<"n="<<n<<",m="<<m<<endl;
}
填空题在C++语言中每个类都有一个{{U}} 【11】 {{/U}}指针,该指针指向正在调用成员函数的对象。
填空题若a=12,b=14,c=0,则表达式“((y=(a>B) ?a:B) >C) ?y:c”的值为______。
填空题执行下列语句后,输出结果为______。
int a=0,b=2,c=3;
switch(a)
{
case 0:switch(b)
{
case 1:cout<<"*";break;
case 2:tout<<"%";break;
}
case 1:switch(C)
{
case 1:cout<<"$";break;
case 2:cout<<"*";break;
default:tout<<"#";
}
}
填空题在关系数据库中,用来表示实体之间联系的是______。
填空题有以下程序:
#include <iostream>
using namespace std;
class A
{
public:
virtual void show()
{
cout<<"A";
}
};
class B : public A
{
public:
void show()
{
cout << "B";
}
};
void display( A * obj )
{
obj-> show();
}
int main ( )
{
A demol;
B demo2;
display(
display(
return 0;
}
执行后的输出结果为{{U}} 【13】 {{/U}}。
填空题若需要把一个函数"void Func();"定义为一个类Sample的友元函数,则应在类 Sample的定义中加入一条语句 【8】 。
填空题对于下面定义的类MyClass,请在函数f( )中添加对象成员把n的值修改为50。
class MyClass
{
public:
MyClass(int x){n=x;}
void SetNum(int nl){n = nl;}
private:
int n;
};
int f( )
{
MyClass * ptr=new MyClass(45);
{{U}} 【12】 {{/U}}
}