填空题使用VC6打开考生文件夹下的工程test6_1,此工程包含一个源程序文件test6_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: Constructor2 Constructor1 i=0 i=10 Destructor 源程序文件test6_1.cpp清单如下: #include<iostream.h> class CSample int i; public; CSample()cout<<"Constructorl"<<endl;i=0;) CSample(int val)cout<<"Constructor2"<<endl;i=val; ~CSample()(cout<<"Destructor"<<endl;) void disp(); ; /**********found********/ void disp() cout<<"i=”<<i<<endl; void main() CSample *a,b(10); /**********found*********/ a->disp(); /**********found*********/ b->disp();
填空题有如下语句序列: int arr[2][2]=9,8,7,6; int *p=arr[0]+1; cout<<*p<<endl; 运行时的输出结果是______。
填空题带参数的流操纵算子 【6】 与成员函数unsetf执行同样的功能。
填空题以下程序的执行结果是 【15】 。 #include<iostream> #define PI____3.14159 const int R=10; void main() double a,b; ac2*R*PI; b=R*R*PI; cout<<"a="<<a<<","<<"b="<<b<<endl;"
填空题如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。
#include<iostream.h>
class test
{
private:
int hum;
public:
test(int);
void show( );
};
test::test(int n){num=n;}
test::show( ){cout<<num<<endl;}
void main( )
{
test T(10):
T.show( );
}
填空题在下面横线上填上适当的语句,完成程序。 #include <iostream> using namespace std; class Base int x: public: Base (int i)x=i; ~Base() ; class Derived : public Base public: ______ //完成类Derive构造函数的定义 ; int main ( Derived Obi; return 0; 在横线外应填入的语句是______。
填空题假设血int a=1,b=2;,则表达式(++a/b)*b--的值为{{U}} 【11】 {{/U}}。
填空题派生类的成员一般分为两部分,一部分是{{U}} 【6】 {{/U}},另一部分是自己定义的新成员。
填空题定义重载函数时,应在参数个数或参数类型上 [13] 。
填空题下面程序的结果为______。 #include<iostream.h> void main() int 3=1,b=2; bool c=1; if(a>b)||c)cout<<“true”<<endl; else cout<<“false”<<endl;
填空题C++中,设置虚基类的目的是 【11】 。
填空题类模板的使用实际上是将类模板实例化成一个具体的{{U}} 【9】 {{/U}}。
填空题在关系数据库中,用来表示实体之间联系的是 【3】 。
填空题若a=12,b=14,c=0,则表达式“((y=(a>B) ?a:B) >C) ?y:c”的值为 【6】 。
填空题下面程序的输出结果为{{U}} 【6】 {{/U}}。
#include <iostream>
using namespace std;
void initialize(int printNo,int state=0);
void initialize(int printNo=1,int state);
int main()
{
initialize();
return 0;
}
void initialize(int printNo, int state)
{
cout<<printNo<<","<<state<<end1;
}
填空题求1~100的和,可写成for(s=0,i=1;{{U}} 【6】 {{/U}};i++)s+=i;的形式。
填空题耦合和内聚是评价模块独立性的两个主要标准,其中{{U}} 【8】 {{/U}}反映了模块内各成分之间的联系。
填空题如果表达式x=y*z中的*是作为成员函数重载的运算符,采用运算符函数调用格式,该表达式还可以表示为______。
填空题全面支持软件开发过程的软件工具集合被称为______。
填空题如下程序定义了单词类word,类中重载了<运算符,用于比较单词的大小,返回相应的逻辑值。程序的输出结果为After Sorting:Happy Welcome,请将程序补充完整。 #include<iostream> #include<string> using namespaee std; class Word public: Word(string s):str(s) string getStr()return str; eonstreturn(str<w.str); friend ostream&operator<<(ostream&output,const Word &w) output<<w.str;return output; private: string str; ; int main() W0rd w1("Happy"),w2("Welcome"); cout<<"After sorting:"; if(w1<w2)cout<<w1<<"<<w2; else cout<<w2<<"<<w1; return 0;
