填空题多态性可分为两类:______和______。
填空题执行"cout<<char('F'-2)<<end1;”语句后得到的输出结果后 【6】 。
填空题下列程序的运行结果为______。 #include<stdio.h> #include<stdio.h> struct A int a;char b[10];double c;; void f(struct A *t); void main() struct A a=1001,"ZhangDa",1098.0; f(&a);printf("%d,%s,%6.1f/n",a.a,a.b,a.c); void f(struct A *t) strcpy(t—>b,"ChangRong");
填空题若下列程序的输出结果是20,请将横线处缺失部分补充完整。
#include
using namespace std;
class MyClass{
pubic;
MyClass(int x=)10:value(x){}
void SetValue(int x){value=x;cout<
填空题若要把类B定义为类A的友元类,则应在类A的定义中加入语句______。
填空题下面程序的输出结果为 【6】 。 #include <iostream> using namespace std; void initialize(int printNo, int state=0); void initialize(iht printNo= 1,int state); int main() initialize(); return 0; void initialize(int printNo, int state) cout<<printNo<<","<<state<<end1;
填空题以下程序中,select函数的功能是:在N行M列的二维数组中,选出一个最大值作为函数值返回,并通过形参传回此最大值所在的行下标。请填空。
#define N 3
#define M 3
int select(int a[N] [M],int
for(i =0;i<N;i++)
for(j = 0;j<M;j++)
if(a[i][j]>a[row][colum]){row=i;colum=j;}
n={{U}} 【7】 {{/U}};
return{{U}} 【8】 {{/U}};
}
main( )
{ int a[N][M] ={9,11,23,6,1,15,9,17,20},max,n;
max =select(a, {{U}}【9】 {{/U}});
printf( "max = % d,line = % d/n",max,n);
}
填空题要获得一数据或数据类型所占空间的字节数,应使用的操作符是 【2】 。
填空题一棵二叉树第六层(根结点为第一层)的结点数最多为 【5】 。
填空题数据的逻辑结构有线性结构和 两大类。
填空题头文件______中包含了处理用户控制的文件操作所需的信息。
填空题请将下列类定义补充完整。
class Base{public:void fun(){cout<<"Base::fun"<<end;}};
class Derived:public Base
{
public:
void fun()
{
______
//显式调用基类的fun函数
cout<<"Derived::fun"<<endl;
}
};
填空题长度为n的顺序存储线性表中,当在任何位置上插入一个元素概率都相等时,插入一个元素所需移动元素的平均个数为{{U}} 【5】 {{/U}}。
填空题下列程序的输出结果是______。 #include <iostream> using namespace std; int main() int data=1; int data+=5; r+=5; cout<<data<<endl; return 0;
填空题以下程序的执行结果是______
#include<iostream.h>
void func(int);
void main()
{
int k=4
func(k) ;
func(k) :
cout<<end1;
}
void func(int a)
{
static int m=0;
m+=a;
cout<<m<<" ";
}
填空题类中包含了一个静态成员函数,则main函数中和P.f1(P);语句具有同样功能的语句为______。 #include<iostream.h> class M public: M(int A)A=a;B+=a; static void f1(M m); private: int A; static int B;; void M::f1(M m) cout<<"A="<<m.A<<endl; cout<<"B="<<m.B<<endl; int M::B=10; void main() M P(5); P.f1(P);
填空题下列软件系统结构图的宽度为________
填空题若要在程序文件中进行标准输入输出操作,则必须在开始的# include命令中使用头文件{{U}} 【11】 {{/U}}。
填空题下面程序的执行结果是 【15】 。#include <iostream. h>void main()int n=0,x=0;don++;if(n%3==2while(x!=1);cout<<"n=" <<n<<end1;
填空题下列程序从保存整数的文本文件"c:Sample. dat"中依次取出每个数据并显示出来,同时统计并显示出所有数据的个数。程序划线处的表达式为 【10】 。 #include<stream, h> #include<stdlib, h> void main( ) ifstream fin ("c: Sample. dat" , ios: :nocreate); if( ! fin) cerr<<"文件无法打开!"<<end1; exit(1); int x,i=0; while(______) cout<<x<<""; i++; fin. close( ); cout<<endl<<"文件中所有整数个数:"<<i<<end1;
