填空题下列程序的输出结果为______。 #include<iostream.h> void Func(char ch) switch(ch) case 'A':case 'a': cout<<"优秀"<<endl; case 'B':case 'b': cout<<"良好"<<endl; break; case 'C':case 'c': cout<<"及格"<<endl; break; default: cout<<"不及格"<<endl; void main( ) char ch1='b' Func(ch1); Func('A');
填空题根据输出结果填空完成下面程序。 #include<iostream.h> class Test private: static int val; int a; public: static int func(); void sfunc(Test &r); ; ______//初始化静态变量val int Test::func() return val++; void Test::sfunc(Test &r) r.a=125; cout<<"Result3="<<r.a; void main() cout<<"Resuh1="<<Test::func()<<end1; Test A; cout<<"Resuh2="<<A.func()<<end1; A.sfunc(A); 输出结果为 Result1=201 Result2=202 Resuh3=125
填空题 是数据库设计的核心。
填空题写出执行完下列代码段之后指定变量的值:
bool x=true ,y=false,z=false;
x=x&&y||z;
y=x||y&&z;
z=!(x!=y)||(y==z);
则x=false,y={{U}} 【6】 {{/U}},z={{U}} 【7】 {{/U}}。
填空题有如下程序: #include <iostream> using namespace std; 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; 执行上面程序的输出结果是 【13】 。
填空题有如下程序:
#include <iostream>
using namespace std;
class AA
{
public:
virtual void f()
{
cout << "AA";
}
};
class BB : public AA
{
public:
BB()
{
cout<<"BB";
}
};
class CC : public BB
{
public:
virtual void f()
{
BB::f();
cout << "CC";
}
};
int main()
{
AA aa,*p; BB bb; CC cc;
p=
p->f();
return O;
}
运行后的输出结果{{U}} 【14】 {{/U}}
填空题已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。 #include<iostream> using namespace std; class TestClass int value; public: TestClass():value(0); void setValue(int value) ______=value;,//给TestClass的数据成员value赋值 void print()cout ; int main() TestClass f; f.setValue(42); f.print(); return 0;
填空题在下向程序和横线处填上适当的内容,使程序执行后的输出结果为1/2005。 #include <iostream> using namespace std; class Date public: Date(int m=1,int y=0):month(m),year(y) void Print() cout<<month<<"/"<<year<<end 1; 【9】 operator+(eonst Date private: int month,year; ; 【10】 operator+(const Date year=d1 .year+d2.year; month=d1. month+d2.month; year+=(month-1 )/12; month=(month-1 )% 12+1; return Date(month,year); void main() Date d1 (3,2004),d2,d3(10); d2=d3+d1; d2,Print();
填空题在C++中,设置虚基类的目的是{{U}} 【14】 {{/U}}。
填空题某二叉树中度为2的节点有18个,则该二叉树中有
________
个叶子节点。
填空题若要将函数“void FriFun();”声明为类MyClass的友元函数,则应在类MyClass的定义中加入语句“______”。
填空题定义重载函数时,应在参数个数或参数类型上{{U}} [15] {{/U}}。
填空题常量和变量的区别是:常量在程序运行中值不变,因此它的值在定义时便进行初始化;而尘量的值是可以改变的,{{U}} 【6】 {{/U}}类型的变量存储的是变量的地址。
填空题使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正错误,使程序正常运行,并且要求最后一个catch必须抛出执行的任何异常。
程序异常,输出信息为 error 0
ERROR
注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。
试题程序: #include<iostream.h> int
main() { try {
throw("error"); }
//********error******** catch(char s)
{ cout<<s<<end1; }
try { throw((int)0);
} //********error******** catch()
{ cout<<i<<end1; }
try { throw(0);
throw("error"); }
//********error******** catch() {
cout<<"ERROR"<<end1; } return
0; }
填空题派生类的成员一般分为两部分,一部分是 【6】 ,另一部分是自己定义的新成员。
填空题有如下的程序:
#include<iostream>
#include<fstream>
using namespace std;
int main(){
char s[25]="Programming language";
ofstream f1("DATA. TXT");
f1<<"C++Programming";
f1.close();
ifstream f2("DATA.TXT");
if(f2.good())f2>>s;
f2.close();
cout<<s;
return 0;
}
执行上面的程序将输出______。
填空题多重表文件和倒排文件都归属于 【3】 文件。
填空题以下程序的运行结果是______。 #include <iostream.h> void main() bool t1=8,t2=0,t3=1; cout<<t1<<'/t'<<t2<<'/t'<<t3<<endl;
填空题由关系数据库系统支持的完整性约束是指 【4】 和参照完整性。
填空题求1~100的和,可写成 for(s=0,i=1; 【8】 ;i++)s+=i; 的形式。
