填空题所有的函数模板定义都是以关键字______开始的,该关键字之后是用______括起来的形式参数表。
填空题当执行以下程序后,i的值是5,j的值是4,k的值是{{U}} [6] {{/U}}。
int a, b, c, d, i, j, k;
a=10; b=c=d=5; i=j=k=0;
for(;a>b; ++b) i++;
while(a>++c) j++;
do {
k++;
}while(a>d++);
填空题下面程序的输出结果为
________
。
#include<iostream.h>
f(int a)
{int b=0;
static int c=3;
b++; c++;
return(a+ b+ c);
}
void main()
{int a=2,i;
for(i=0;i<3;i++)
cout<<f(a)<<end1;
}
填空题对于长度为n的有序线性表,在最坏情况下,二分查找需要比较log2n,那么顺序查找需要比较的次数是 【2】 。
填空题operator是运算符重载时必须使用的关键字,它和被重载的运算符连在一起,作为运算符函数的专用函数名,务必把该函数说明为【 】的。
填空题下列程序的运行结果是______。 #include<iostream.h> class Base public: void f(int x)cout<<"Base:"<<x<<endl; ; class Derived:public Base public: void f(char*str)cout<<"Derived:"<<str<<endl;) ; void main(void) Base*pd=new Base; pd=new Derived; pd->f('a');
填空题在面向对象方法中,{{U}} 【2】 {{/U}}描述的是具有相似属性与操作的二组对象。
填空题将代数式z=转换成程序设计中的表达式为{{U}}【2】{{/U}}。
填空题软件工程研究的内容主要包括:
【4】
技术和软件工程管理。
填空题冒泡排序在最好情况下时间复杂度为
________
。
填空题已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。 #include <iostream> using namespace std; class Foo int value; public: Foo():value(0) void setValue(int value) ______=value;//给Foo的数据成员value赋值 void print() cout<<value; ; int main() Foo f; f.setValue(42); f.print(); retum 0;
填空题在面向对象的程序设计中,类描述的是具有相似性质的一组 。
填空题函数模板既可以与______重载,也可以与______重载。
填空题下列函数的功能是 【7】 。 #include<iostream. h> int Func(int a,int b) if (a>b) return 1; else if(a==b) return 0; else return -1;
填空题假设fin是一个文件流对象,则关闭文件的语句是 。
填空题在MyClass类的定义中,对赋值运算符=进行重载。请将画线处缺失的部分补充完整。 ______MyClass::operator=(const MyClass value=ths.value; return *this;
填空题常见的软件开发方法有结构化方法和面向对象方法。对某应用系统经过需求分析建立数据流图(DFD) ,则应采用___【3】___方法。
填空题下面程序的输出结果是{{U}} 【8】 {{/U}}。
#include<iostream>
using namespace std;
int x;
void funA(int&,int);
void funB(int,int&);
int main()
{
int first;
int second=5;
x=6;
funA(first,seconD) ;
fimB(first,seconD) ;
cout<<first<<" "<<second<<" "<<x<<end1;
return 0;
}
void funA(int &a,int B)
{
int first;
first=a+b;
a=2*b;
b=first+4;
}
void funB(int u,int &v)
{
int second;
second=x;
v=second+4;
x=u+v;
}
填空题以下程序的输出结果为{{U}} 【7】 {{/U}}。
#include<iostream>
using namespace std;
void initialize(int printNo,int state=0);
void initialize(int printNo=l,int state);
int main()
{
initialize();
return 0;
}
void initialize(int printNo,int state)
{
cout<<printNo<<","<<state<<end1;
}
填空题C++中使用 [6] 代替C语言中的宏。