填空题表达式cout<<'\n'还可表示为______。
填空题以下程序的输出结果是{{U}} 【10】 {{/U}}。
#include<iostream.h>
unsignedfun(unsignednum)
{ unsignedk=1;
do { k * =num%10;num/=10;}while(num);
returnk;
}
voidmain( )
{ unsignedn=26;
cout<<fun(n)<<endl;
}
填空题当使用带参数的操作子时,程序中必须包含头文件______。
填空题以下函数 rotate 的功能是:将 a 所指 N 行 N 列的二维数组中的最后一行放到 b 所指二维数组的第 0 列中,把 a 所指二维数组中的第 0 行放到 b 所指二维数组的 最后一列中,b 所指二维数组中的其他数据不变。
# define N 4
void rotate(int a[][N],int b[][N])
{ int i,j;
for(i=0;i
填空题C++是通过______译成目标语言的。
填空题下面程序的运行结果是【 】和【 】。
#include<iostream.h>
#define N 10
#define s(x)x * x
#define f(x)(x * x)
void main( )
{ int i1,i2;
i1=1000/s(N);i2=1000/f(N);
cout < < i1 < < " " < < i2;
=
填空题有如下定义:
class MA{
int value;
public:
MA(int n=0):value(n){}
};
MA*ta,tb;
其中MA类的对象名标识符是{{U}} 【9】 {{/U}}。
填空题有如下递归函数:
int Fun(int n){
if(n<=1) return 1;
______
}
请补充完整,使得函数Fun能够正确计算形参n的阶乘。
填空题下面程序运行时输出结果为 【8】 。 #include<iostream.h> #include<malloc.h> class Rect public: Rect(int1,int w)(length=1;width=w;) void Print()cout<<"Area:"<<length *width<<endl;) void *operator new(size-t size)return malloc(size); void operator delete(void *p)free(p) private: int length,width; ; void main() Rect*p; p=new Rect(5,4); p->Print(); delete p;
填空题下面程序的结果为{{U}} 【7】 {{/U}}。
#include<iostream.h>
void main( )
{
int a=1,b=2;
bool c=1;
if((a>b) ||c) cout<<"true"<< end1;
else
cout<<"false"<<end1;
}
填空题有以下程序#include <iostream>using namespace std;class Base int a;public: Base(int x) a=x; void show() cout<<a; class Derived: public Base int b;public: Defived(int i):Base(i+ 1 ),b(i) void show() cout<<b; ;int main() Base b(5),*pb; Derived d(1); pb= pb->show(); return 0;运行后的打印结果是______。
填空题阅读下面的程序:
#include<iomanip.h>
void main()
{
cout.fill('!');
cout<<setiosflags(ioS::left)<
填空题写出下列程序代码运行的结果 [11] 。 #include<iostream.h> class A public: virtual void disp() cout<<" calss A!" <<(end1; : class B: public A public: void disp() cout<<" class B! " <<end1: ; class C: public A public: void disp() cout<<"class C! " (<end1; ; void main() A a, *ptr; B b; C c;a. disp();b. disp();c. disp(); ptr= ptr->disp(); ptr= ptr->disp():
填空题使用VC6打开考生文件夹下的工程test18_1,此工程包含一个源程序文件test18_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: Enter x and y: -4 -5 xoffset=1 yoffset=1 angle=45 radius=1.41421 源程序文件test18_1.cpp 清单如下: #include <iostream.h> #include <math.h> class point public: void set(double ix,double iy) x=ix; y=iy; double xoffset() return x; double yoffset() return y; double angle ( ) return (180/3.14159)*atan2(y,x); /**************** found *******************/ inline radius ( ) return sqrt(x*x+y*y); protected: double x; double y; ; void main() point p; double x,y; cout<<"Enter x and y:/n"; cin>>x>>y; p.set(x,y); /**************** found *******************/ p.x+=5; p.y+=6; /**************** found *******************/ cout<<"xoffset="<<p.xoffset()<<end1; cout<<"yoffset="<<p.yoffset()<<end1; cout<<"angle="<<p.angle()<<end1; cout<<"radius="<<p.radius()<<end1;
填空题有如下程序段:
intx=1,y=2,z=3;
x=x^z:
y=y^z;
z=x^y:
cout<<x<<y<<z;
这个程序段的输出结果是______。
填空题假定A为一个类,则语句A(A&a);为该类______函数的原型说明。
填空题已知程序的结果为1 2 3,请填空。 #include<iostream.h> template<class T> class A public: T X, y, z; void display( ) cout < < x < < " " < < y < < " " < < z; ; void main( ) A<int>a1; 12 13 14 a1.display( ) ;
填空题有如下的程序:
#include <fstream>
using namespace std;
int main () {
ofstream outf("D: //temp" ,ios_base::trunc);
outf<<"World Wide Web";
outf.close ();
ifstream inf("D: //temp");
char s[20];
inf>>s;
inf.close();
cout<<s;
return0;
}
执行上面的程序将输出______。
填空题C++语言的函数参数传递方式有值传递和{{U}} [10] {{/U}}、引用传递。
填空题在最坏情况下,堆排序需要比较的次数为 【2】 。
