选择题 有如下程序:
#include<iostream>
using namespace std;
class Rect{
int x, y;
public:
Rect(int x1=0, int y1=0):x(x1), y(y1) {}
int get() {return x*y;}
};
class Cube{
Rect plane;
int high;
public:
Cube(int cx, int cy, int ch):plane(cx, cy), high(ch){}
int get(){return plane.get()*high;}
};
int main(){
Cube e(3, 4, 5);
cout<<c.get()<<endl;
return 0;
}
运行时的输出结果是______。
选择题 下列关于栈的叙述正确的是______。
选择题 定义无符号整数为Uint,下面可以作为类Uint实例化值的是______。
选择题 下列语句中错误的是______。
选择题 下列程序段中包含4个函数。其中具有隐含this指针的是______。
int fun1();
class Test{
public:
int fun2();
friend int fun3();
static int fun4();
}
选择题 有下列程序:
#include <stdio.h>
void main()
(int a[]={1,2,3,4),y,*p=&a[3];
--p;y=*p;printf('y=%d\n',y);
}
程序的运行结果是 ,
选择题 以下程序试图把键盘终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符“#”时结束输入和输出操作,但程序有错。程序出错的原因是______。
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ofstream ofile;
char ch;
ofile.open('d:\\abc.txt','W');
do{
cin>>ch:
ofile.put(ch);
}while(ch!='#');
ofile.close();
return 0;
}
选择题 有如下类定义:
class MyClass{
Int value;
public;
MyClass(int n):value(n){}
int gerValue()const{return value;}
};
则类MyClass的构造函数的个数是______。
选择题 下列说法中错误的是______。
选择题 下面程序的运行结果为______。
#include<iostream. h>
void main()
{
for(int a=0, x=0;! xa<=10; a++)
{
a++;
}
cout<<a<<endl;
}
选择题 下列C++流的操作符中,能够设置下一个数据的输出宽度的操作符是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class Base
{
private:
void fun1()const{cout<<'fun1';}
protected:
void fun2()const{cout<<'fun2';}
public:
void fun3()const{cout<<'fun3';}
};
class Derived:protected Base
{
public:
void fun4()const{tout<<'fun4';j
};
int main()
{
Derived obj;
obj.fun1();//①
obj.fun2();//②
obj.fun3();//③
obj.fun4();//④
return 0;
}
其中有语法错误的语句是______。
选择题 下列函数参数默认值定义错误的是 。
选择题 设有定义“int x=2;”,下列表达式中,值不为6的是______。
选择题 下面程序的运行结果是______。
#include<iostream.h>
int fun(int a[],int n)
{
int result=1;
for(int i=1;i<n;i++)
result=result*a[i];
return result;
}
void main()
{
int a[3]={3,4,5);
cout<<fun(a,3)<<endl;
}
选择题 若需要为XV类重载乘法运算符,运算结果为XV类型,在将其声明为类的成员函数时,下列原型声明正确的是______。
选择题 下面关于C++流的叙述中,正确的是 。
选择题 字符串“a+b=12\n\t”的长度为______。
选择题有二个关系R、S和T如下。则由关系R和S得到关系T的操作是
选择题 下面对静态数据成员的描述中,正确的是______。
