填空题使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正程序中的错误,使得程序输出: 9,8,7,6,5 注意:错误的语句在/********error********/的下而,修改该语句即可。其他的语句不能修改。 试题程序: #include<iostream.h> class TC /********error********/ TC(int i) m_i=1; void print() cout<<--m_i<<','; public: int m_i; ; int main() /********error********/ int i(); TC obj(10); while(i>5) /********error********/ i++; obj.print(); cout<<end1; return 0;
填空题软件维护活动包括改正性维护、适应性维护、______维护和预防性维护。
填空题将下面的语句段(A) 补充完整,使其和语句段(B) 在功能上完全等价。
(a) double s=0.0;
{{U}}【8】 {{/U}};
int k=0;
do{
s+=d;
k++;
d=1.0/(k*k+1);
}while({{U}} 【9】 {{/U}});
(b) double s=1.0;
for(int k=1;k<=10;k++) s+=1.0/(k*(k+1));
填空题在ios_base类中定义的用于控制输入输出格式的枚举常量中,用于控制浮点数表示形式(科学计数法、定点表示法)的2个常量的名字是______。
填空题执行以下程序,输出结果的最后一行语句是______。 #include <iostream.h> class Sample int x,y; public: Sample()x=y=0; Sample(int a,int b)x=a;y=b; ~Sample() if(x==y) cout<<"x!=y"<<end1; else cout<<"x!=y"<<end1; void disp() cout<<"x="<<x<<",y="<<y<<end1; ; void main() Sample s1(2,3); s1.disp();
填空题下列程序的输出结果是 【14】 。 #include<iostream.h> void main() inta(5),b(6),i(0)1j(0); switch(a) case 5:switch(b) case 5:i++;break; case 6:j++;break; defaun:i++;j++; case 6:i++; j++; break; default:i++;j++; cout<<i<<","<<j<<endl; )
填空题有些运算符既可以作为成员函数重载,也可以作为非成员函数重载。若在一个重载的运算符函数的定义中成功地使用了this指针,说明它是作为【13】重载的。
填空题索引从物理上分为聚簇索引和{{U}} 【5】 {{/U}}。
填空题以下程序的输出结果是{{U}} [10] {{/U}}。
#include<iostream. h>
void main() {
int *p;
p=new int;
*p=200;
cout<<*p;
delete p;
}
填空题当数据的物理结构(存储结构、存取方式等) 改变时,不影响数据库的逻辑结构,从而不会引起应用程序的变化,这是指数据的 。
填空题声明长度为10的float型数组a,且初始化为0的语句是{{U}} 【15】 {{/U}}。
填空题有如下程序段:
int x=1,y=2,z=3;
x=x^z;
y=y^z;
z=x^y;
cout<<x<<y<<z;
执行这个程序段的输出是______。
填空题下面程序运行后输出的结果是{{U}} 【12】 {{/U}}。
#include <iostream>
using namespace std;
class example{
const int m;
public:
example(int i):m(i){}
void pr(){cout<<"m="<<m<<endl'}
};
int main(){
example x(100);
x.pr();
return 0;
}
填空题以随机访问方式读取文件中的数据通常使用istream的成员函数______。
填空题以下程序的输出结果是{{U}} 【10】 {{/U}}。
#include<iostream.h>
unsigned fun (unsigned num)
{unsigned k=1;
do{k*=num%10;num/=10;} while(num);
return k;
}
void main( )
{ unsigned n=26;
cout <<fun(n) <<end1;
}
填空题下面程序的输出结果是______。
#include<iostream>
using namespace std;
class Base{
int x;
public:
Base(int b):x(b){}
virtual void display(){cout<<x;}
};
class Derived:public Base{
int y;
public:
Derived(int d):Base(d),y(d){}
void display(){cout<<y;}
};
int main(){
Base b(1);Derived d(2);
Base*p=
b.display();d.display();p->display();
return 0;
}
填空题下列程序的执行结果是 【7】 。 include <iostream. h> int a; int sum_a(void) a=a+5; return a; void main(void) a = a+sum_a(); cout<<a<<endl;
填空题下列程序的输出结果为Object id=0Object id=1请将程序补充完整。#include <iostream>using namespace std;class Pointpublic: Point(int xx=0,int yy=0) X=xx; Y=yy; countP++; ~Point()countP--; int GetX()retum X; int GetY()return Y; static void GetC() cout<<"Object id="<<countP<<end1;private: int X,Y; static int countP;; 【11】 //静态数据成员的初始化int main() Point:: GetC(); Point A(4,5); A. GetC(); retum 0;
填空题以下函数用来求出数组的最大元素在数组中的下标并存放在k所指的存储单元中。请填空。 #include<iostream.h> void fun(int * s,int t,int * k) int i; * k= 【9】 ; 【10】 if(s[ * k] < s[i]) * k=i; void main( ) int a[l0]= 876,675,896,101,301,401,980,431,451,777 ,k; fun(a,10,&k); cout < < k < <"," < < a[k];
填空题以下程序的执行结果是______。 #include <iostream> using namespace std; class base public: virtual void who() cout<<"Base Class"<<endl; ; class Derived1: public Base public: virtual void who() cout<<"Derived1 Class"<<endl; ; class derived2: public Base public: virtual void who() cout<<"Derived2 Class"<<endl; ; int main(int argc, char *argv[ ]) base obj1,*p; derived1 obj2; derived2 obj3; p= p->who(); p= p->who(); p= p->who(); return 0;
