填空题空字符串的长度是_____。
填空题虚基类是含有{{U}} {{U}} {{/U}} {{/U}}函数的类。
填空题补充完整下面的模板定义:
template<class Type> //Type为类型参数
class Xtwo{ //由两个Type类型的数据成员构成的模板类
Type a;
Type b;
public:
Xtwo(Type aa=0,Type bb=0):a(aa),b(bb){}
int Compare( ){ //比较a和b的大小)
if(a>b) return 1;
else if(a= =b) return 0;
else return -1;
}
Type Sum( ){return a+b;)//返回a和b之和
Type Mult( ); //函数声明,返回a和b之乘积
};
template<class Type>
______::Mult( ){ return a*b;}//Mult函数的类外定义
填空题若有以下程序段:
#include <iostream>
using namespace std;
int main()
{
char*p="abcdefgh",*r;
long*q;
q=(long*)p;q++;
r=(char*)q;
cout<<r<<end1;
return 0;
}
该程序的输出结果是{{U}} 【8】 {{/U}}。
填空题表达式 c3=c1.operator+(c2)或c3=operator+(c1,c2)还可以表示为 【10】
填空题请将下列程序中的函数声明语句补充完整。 #include<stdio.h> int ______; void main() int x,y(*p)(); scanf("%d%d",&x,&y); p=max; printf("%d/n",(*p)(x,y)); int max(int a,int b) return(a>b?a:b);
填空题下列程序输出结果是______。 #include<stdio.h> void main() int j,a[]=1,3,5,7,9,11,13,15,*p=a+5; for(j=3;j;j--) switch(j) case 1: case 2:printf("%d",*p++);break; case 3:printf("%d",*(--p));
填空题阅读下列程序,写出程序的运行结果 [8] 。 #include<iostream. h> void main() char str1[ ]: "Hello, World?; char str2[100]; int i=0; do if (str1[i]>= 'a' else str2[i]=strl [i]; i++; while(strl[i]!='/0'); str2[i]='/0'; cout<<str1<<end1; cout<<str2<<end1;
填空题下面程序运行输出的结果是______。 #include <iostream> using namespace std; int main() char a[]="Chinese"; a[3]='/0'; cout<<a<<endl; return 0;
填空题已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。
#include <iostream>
using namespace std;
class Foo {
int value;
public:
Foo 0=:value(0) {}
void setValue(int value)
{{{U}} {{U}} {{/U}} {{/U}}= value; }//给Foo的数据成员value赋值
void print() { cout << value; }
};
int main()
{
Foo f;
f.setValue(42);
f.print();
return();
}
填空题有以下程序: #include <iostream> using namespace std; const xnt N=5; int fun(char *s,char a,int n) int j; *s=a;j=n; while(a<s[j]) j--; return j; int main() char s[N+1]; int k; for(k=0;k<=N;k++) s[k]='A'+k+1; cout<<fun(s,'E',N)<<end1; return 0; 运行后的打印结果是______。
填空题下列软件系统结构图的宽度为________
填空题以下程序的执行结果是 【15】 。 #include <iostream.h> #include <fstream.h> #include <stdlib.h> int main() fstream outfile, infile; outfile.open("D://text.dat",ios::out); if(!outfile) cout<<"text.dat can't open"<<end1; abort(); outfile<<"1234567890"<<end1; outfile<<"abcdefghij"<<end1; outfile.close(); infile.open("D:/text.dat",ios::in); if(!infile) cout<<"text.dat can't open"<<end1; abort ( ); char textline[40]; int i=0; while(!infile.eof()) i++; infile.getline(textline,sizeof(textline)); cout<<i<<":"<<textline<<end1; infile.close(); return 0;
填空题下列程序的运行结果是______。 #include<iostream. h> class Base public: virtual void func(int i)cout<<"class Base:"<<i<<endl; ; class Derived: public Base public: void func(double d)cout<<"class Derived:"<<d<<endl; ); void main() Base a, *p= Derived b; p= (* p).func(3.3);
填空题常数据成员和静态数据成员在使用前共同的要求是要进行{{U}} {{U}} {{/U}}{{/U}}。
填空题假定用户没有给一个名为MyClass的类定义析构函数,则系统为其定义的默认析构函数首部形式为{{U}} 【7】 {{/U}}。
填空题若以非成员函数形式,为类Bounce重载“!”运算符,其操作结果为一个bool型数据,则该运算符重载函数的原型是______。
填空题当数据的物理结构(存储结构、存取方式等) 改变时,不影响数据库的逻辑结构,从而不会引起应用程序的变化,这是指数据的{{U}} {{/U}}。
填空题有如下类定义: class Sample public: Sample(); ~Sample(); private: static int data; ; 将静态数据成员data初始化为0的语句是______。
填空题类istream的成员函数______从指定流中读取一个字符,成员函数______和______从指定流中读取多个字符。
