填空题下列程序段的输出结果是 。 cout < < fixed < < 509.123456789 < < endl;
填空题以下程序的输出结果是【 】。
#include<iostream.h>
void main( )
{ int a=0;
a+ =(a=8);
cout < < a;
=
填空题冒泡排序算法在最好的情况下的元素交换次数为{{U}} 【1】 {{/B}}。{{/U}}
填空题假设int a=1,b=2;则表达式a+++--b的值为 【7】 。
填空题在长度为n的有序线性表中进行二分查找。最坏的情况下,需要的比较次数为 【2】 。
填空题cout.put(‘A’);,还可以表示为 【15】 。
填空题基类的 [12] 不能被派生类的成员访问,基类的 [13] 在派生类中的性质和继承的性质一样,而基类的 [14] 在私有继承时在派生类中成为私有成员,在公有和私有保护继承时在派生类中仍为保护成员。
填空题定义重载函数时,应在参数个数或参数类型上 [15] 。
填空题以下程序的输出结果是{{U}} 【13】 {{/U}}。
#include<iostream.h>
int add(int x,int y)
{
retum X+y;
}
dOuble add(dOUble x,double y)
{
return x+y;
}
void main()
{
int a=4,b=6;
double c=2.6,d=7.4;
cout<<add(a,b)<<",”<<add(C,d)<<endl;
}
填空题使用VC++6.0打开考生文件夹下的源程序文件3.cpp,其中定义了用于表示Et期的类Date,但类Date的定义并不完整,按要求完成下列操作,将类的定义补充完整。 (1)定义私有成员变量year、month、day,分别表示年、月、日,类型为int。请在注释1后添加适当的语句。 (2)完成构造函数,分别给year、month、day赋值,请在注释2后添加适当的语句。 (3)完成重载符号“+=”的定义,请在注释3后添加适当的语句。 (4)完成函数print打印函数,如2005年1月5日到屏幕和文件out3.txt格式相同,请在注释4后添加适当的语句。 注意:增加代码,或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。 试题程序: #include<iostream.h> #include<fstream> #include<iomanip> #include<cmath> using namespace std; void WriteFile(int c) ofstream out1; out1.open("out3.txt",ios_base::app); out1<<c<<''; out1.close(); void WriteFile(char *str) ofstream out1; out1.open("out3.txt",ios_base::app); out1<<str; out1.close(); void ClearFile() ofstream out1; out1.open("out3.txt"); out1.close(); class Date public: Date(int y,int m,int d) //********1******** void print(); //********2******** month+=m; int i=month/12; int j=month%12; if(j==0) year+=(i-1); month=12; else year+=i; month=j; return *this; private: //********3******** ; void Date::print() //********4******** WriteFile(year); WriteFile("年"); WriteFile(month); WriteFile("月"); WriteFile(day); WriteFile("日"); int main() ClearFile(); Date National_day(2004,10,5); National_day+=3; National_day.print(); return 0;
填空题下面是用来计算n的阶乘的递归函数,请将该函数的定义补充完整(注:阶乘的定义是
n!=n*(n-1)*...*2*1)。
unsigned fact(unsigned n)
if (n <= 1)
return 1;
return{{U}} 【14】 {{/U}};
}
填空题在C++中,给一变量取别名,可以通过 【10】 方式。
填空题有如下的程序:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream outf("D://temp.txt",ios_base::trunc) ;
outf<<"World Wide Web";
outf.close();
ifstream inf("D://temp.txt");
char s[20];
inf>>s;
inf.close();
cout<<s;
return 0;
}
执行后的输出结果是{{U}} 【15】 {{/U}}。
填空题在关系代数运算中,并、笛卡尔积、投影、选择和 [4] 为基本的运算。
填空题关系中的“主键”不允许取空值是指 [5] 约束规则。
填空题在C++语言中每个类都有一个【 】指针,该指针指向正在调用成员函数的对象。
填空题若有定义语句:int a=3,b=2,c=1;,则表达式a<b ? a:b的值是{{U}} 【10】 {{/U}}。
填空题数据库系统阶段的数据具有较高独立性,数据独立性包括物理独立性和
________
两个含义。
填空题有以下程序: #include<iostream> using namespace std; class MyClass public: static int s; MyClass(); void SetValue(int val); ; int MyClass::s=0; MyClass::MyClass() S++; void MyClass::SetValue(int val) s=val; int main() MyClass my[3],*p; p=my; for(int k=0;k<3;k++) p->SetValue(k+1); p++; cout<<MyClass::s<<end1; return 0; 运行后的输出结果是______。
填空题下列程序段的输出结果是{{U}} {{/U}}。
cout < < fixed < < 509.123456789 < < endl;
