填空题在C++语言中,一个函数的定义前加上关键字______时,该函数就声明为内联函数。
填空题若已定义,以下fun函数的功能是:在第一个循环中给前10个数组元素依次赋1、2、3、 4、5、6、7、8、9、10;在第二个循环中使a数组前10个元素中的值对称折叠,变成1、 2、3、4、5、5、4、3、2、1。请填空。
fun( int a[])
{
int i,
for(i=1;i<=10;i++){{U}} 【11】 {{/U}}=i;
for(i=0;i<5;i++){{U}} 【12】 {{/U}}=a[i];
}
填空题数据结构分为逻辑结构与存储结构,线性链表属于 【1】 。
填空题在C++中,一个函数一般由两部分组成,分别是函数头和 【12】 。
填空题下列程序如果去掉for循环外围的大括号对,则会出现编译错误。错误原因是{{U}} 【7】 {{/U}}。
# include<iostream, h>
int a=5;
void main()
{
int a=10, b=20;
cout<<a<<", "<<b<<end1;
{
int a=0, b=0;
for (int i=1;i<8;i++)
{
a+=i;
b+=a;
}
cout<<a<<", "<<b<<", "<<:: a<<end1;
}
cout<<a<<", "<<b<<end1;
}
填空题已知如下程序的输出结果是23,请将画线处缺失的部分补充完整。
#include<iostream>
using namespace std;
class MyClass{
public:
void Print( )const{eout<<23;}
};
int main( ){
MyClass*P=new MyClass( );
______.Print( );
return 0;
}
填空题在关系模型中,把数据看成一个二维表,每一个二维表称为一个______。
填空题下列程序对加号进行了重载,划线部分的语句是 【15】 。 # include<iostream. h> # include<math. h> class Triangle int x,y,z; double area; public: Triangle(int i,int j, int k) double s; x=i;y=j;z=k; s=(x+y+z)/2.0; area=sqrt(s*(s-x)*(s-y)*(s-z)); void disparea() cout<<"Area="<<area<<endl; friend double operator+(Triangle t1,Triangle t2) ______ ; void main() Triangle t1(3,4,5),t2(5,12,13); double s; cout<<"t1:";t1.disparea() cout<<"t2:";t2.disparea() s=t1+t2; tout<<"总面积:="<<s<<endl;
填空题广义表的深度是指 【2】 。
填空题在C++类中,默认的数据成员的访问权限是{{U}} 【6】 {{/U}}。
填空题在一个容量为25的循环队列中,若头指针front=15,尾指针rear=6,则该循环队列中共有{{U}} 【2】 {{/U}}个元素。
填空题所有的函数模板定义都是以关键字template开始的,在template之后使用 [12] 括起来的形参表。
填空题当派生类中有和基类相同名字的成员时,派生类的同名成员会
________
基类的成员。
填空题下列程序的输出结果为2,请将程序补充完整。
using namespace std;
class Base
public:
{{U}} 【12】 {{/U}}void fun() {cout<<1;}
};
class Derived:public Base
{
public:
void fun() {cout<<2;}
int main()
{
Base*p=new Derived;
p->fun();
delete p;
return 0';
}
填空题非成员函数只有在声明为类的______才能访问这个类的所有private成员。
填空题执行“cout.<<char(‘F’,-2)<<end 1;”语句后得到的输出结果为{{U}} 【3】 {{/U}}。
填空题己知一个函数的原型是:
int fn(double x);
若要以5.27为实参调用该函数,应使用表达式{{U}} 【8】 {{/U}}。
填空题执行下列语句段后程序的输出结果是______。 int x[]=1,2,3,4,5; int q=x; cout*(++q)<<end1;
填空题程序的输出结果是______。
#include<iostream>
using namespace std;
class Base{
int x;
Public:
Base(int B):x(B) {}
virtual void display( ){cout<<x;}
};
class Derived:public Base{
int y;
public:
Derived(int D):Base(D),y(D){}
void display( ){cout<<y;}
};
int main( ){
Base b(1) ;Derived d(2);
Base*p=&d;
b.display( );d.display( );p—>display( );
return 0;
}
填空题下面程序的输出结果是 。 #include<iostream.h> void main( ) int a[6] =1,2,3,4,5,6; for(int i=0;i<5;i++) cout < < a[i] < <" "; cout < < endl;
