填空题程序的结果为{{U}} 【14】 {{/U}}。
#include”iostream.h”
template<typename T >
T total(T * data)
{
T s=0;
while( * data)
{
s+= * data ++;
}
return s;
}
int main( )
{ int x[ ]= { 2,4,6,8,0,12,14,16,18 };
cout < < total(x);
return 0;
cout < < end1;}
填空题逻辑表达式x>3&&x<10的相反表达式为______。
填空题如果类中的一个成员函数的定义实现在类内,则该函数系统自动默认为该类的 【10】 函数。
填空题c++语言中的多态性分为编译时的多态性和______时的多态性。
填空题写出下列程序的运行结果______。 #include <iostream.h> #include <fstream.h> #include <stdlib.h> void main() fstream outfile,infile; outfile.open("data.dat" ,ios::out); if(!outfile) cout<<"Can't open the file."<<endl; abort(); outfile <<"1234567890"<<endl; outfile<<"aaaaaa.aaa"<<endl; outfile<<"**********"<<endl; outfile.close(); in file.open("data.dat",ios::in); if(!infile) cout<<"Can't open the file."<<endl; abort(); char line[80]; int I=0; while(!infile.eof()) I++; infile.getline(line,sizeof(line)); cout<<I<<":"<<line<<endl; infile.close();
填空题在下面函数的画线处填上适当的内容,使该函数能够利用递归方法求解字符串str的长度(不得使用系统提供的字符串处理函数)。
int GetLen(char*str){ if({{U}} (6)
{{/U}})return{{U}} (7) {{/U}}; else return
1+GetLen(str+1); {
填空题要获得一数据或数据类型所占空间的字节数,应使用的操作符是{{U}} 【2】 {{/U}}。
填空题程序测试分为静态分析和动态测试。其中 【5】 是指不执行程序,而只是对程序文本进行检查,通过阅读和讨论,分析和发现程序中的错误。
填空题在C++语言的结构化程序设计中, 6 是程序的基本组成单元;在C++语言的面向对象设计框架中, 7 是程序的基本组成单元。
填空题在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。 #include <iostream> using namespace std; class A public: A() cout<<'A'; ; class B: 【11】 public:B() cout<<'B'; ; class C: 【12】 public: C()cout<<'C'; ; class D:public B,public C public:D() cout<<'D'; ; void main() D obj;
填空题C++语言支持的两种多态性分别是编译时的多态性和{{U}} 【13】 {{/U}}的多态性。
填空题我们通常用到的cin>>,是属于{{U}} 【15】 {{/U}}输入。
填空题C++中封装性、继承性和【 】是面向对象思想的主要特征。
填空题假设int a=1,b=2;,则表达式(++a/B) *b--的值为 【8】 。
填空题fun()函数的功能是:首先对a所指的N行N列的矩阵,找出各行中的最大的数,再求这N个最大值中的最小的那个数作为函数返回值。请填空完成此程序。 #define N 100 int fun(int (*A) [N]) int row,col,max,min; for(row=0;row for(max=a[row][0],col=1;col if( 【7】 ) max=a[row][col]; if(row==0) min=max; else if( 【8】 ) min=max; return min;
填空题以下程序的输出结果是{{U}} 【9】 {{/U}}。
#include <iostream>
using namespace std;
void fun()
{
static int a=0;
a+=2;
cout<<a;
}
int main()
{
int CC;
for(CC=1;cc<4;CC++)
fun();
cout<<end1;
return 0;
}
填空题下列程序的输出结果是 【11】 。 #include <iostream> using namespace std; class Test public: Test() cnt++; ~Test() cnt--; static int Count() (return cnt; private: static int cnt; ; int Test::cnt=0; int main() cout<<Test::Count()<<''; Test t1, t2; Test *pT3=new Test; Test *pT4=new Test; cout<<Test::Count()<<''; delete pT4; delete pT3; cout<<Test::Count()<<end 1; return 0;
填空题软件工程的框架可概括为:目标、过程和{{U}} 【4】 {{/U}}。
填空题派生类构造函数的执行顺序是先执行 【12】 的构造函数,然后执行成员对象的构造函数,最后执行 【13】 的构造函数。
填空题下列程序的输出结果是______。 #include <iostream> using namespace std; class A int a; public: A():a(9) virtual void print() constcout<<a;; ; class B: public A char b; public: B()b='S'; void printo const cout<<b; ; void show(A int main() A d1,*p; B d2; d1.print(); d2.print(); p->print(); show(d1); show(d2); return 0;
