单选题下列关于C++流的描述中,错误的是______。 A.cout>>'A'表达式可输出字符A B.eof()函数可以检测是否到达文件尾 C.对磁盘文件进行流操作时,必须包含头文件fstream D.以ios_base::out模式打开的文件不存在时,将自动建立一个新文件
单选题若有以下定义: int a[]=1,2,3,4,5,6,7; char c1='b',C2='2'; 则数值不为2的表达式是
单选题有如下程序:
#include<iostream>
using namespace std;
class test{
private:
int a;
public:
test(){cout<<"constructor"<<endl;}
test(int a){cout<<a<<endl;}
test(const test
cout<<"copy constructor"<<endl;
}
~test(){cout<<"destructor"<<endl;}
};
int main(){
test A(3);
return 0;
}
执行这个程序的输出结果是______。
单选题执行下列语句段后int n=0; for (int i=70; i>0; i-=3) n++;n的值是
单选题有以下程序 #include<iostream.h> void main() int a=5,b=0,c=0; if(a=b+c)cout<<"***"<<endl: else cout<<"$$$"<<<endl; 下列选项叙述正确的是( )。
单选题设有程序段: int k=10; while(k=0) k=k-1; 则下面描述中正确的是
单选题Sample是一个类,执行下面语句后,调用Sample类的构造函数的次数是______。 Sample
a[2],*p=new Sample;
A.0
B.1
C.2
D.3
单选题有如下程序: #inc1ude<iostream> using namespace std; c1ass Boat; c1ass Car{ public: Car(int i):weight(i){} friend int Total(const Car //① private: int weight; }; c1ass Boat{ public: Boat(int i):weight(i){} friend int Total(const Car private: int weight; }; int Total(const Car } int main0{ Car c(10), Boat b(8); cout<<"The totalweightis "<<Total(c,b)<<end1; //③ returnO; }下列关于程序的描述中,正确的是( )。
单选题下列函数中对调用它的函数没有起到任何作用的是( )。 A.void f1(double B.double f2(double x)return x-1.5; C.void f3(double x)--x; D.double f4(double *x)--*x;return *x;
单选题在进行任何C++流的操作后,都可以用C抖流的有关成员函数检测流的状态;其中只能用于检测输入流状态的操作函数名称是( )。
单选题下列情况中,不会调用拷贝构造函数的是( )。
单选题有如下程序:
#include
using namespace std;
class Obj {
static int i;
public:
Obj() { i++; }
~Obj() { i--; }
static int getVal() { return i;}
};
int Obj::i=0;
void f() {Obj ob2; coutgetVal();
delete ob3; cout<
单选题在一个长度为n的线性表中插入一个元素,最好情况下需要移动的数据元素数目
单选题有如下程序: #inc1ude<iostream> using namespace std; void fl(int f1(x); f2(y); cout<<x+y<<end1; return 0; } 运行这个程序的输出结果是( )。
单选题下列程序的运行结果为______。
# include<iostream.h>
template<class TT>
class FF
{ TT a1,a2,a3;
public:
FF(TT b1,TT b2,TT b3){a1=b1;a2=b2;a3=b3;}
TT Sum(){return a1+a2+a3;));
void main()
{ FF<int>x(int(1.1),2.3),y(int(4.2),5,6);
cout<<x.Sum()<<""<<y.Sum()<<encIl;}
单选题下列模板声明中,有语法错误的是______。
单选题对于一个类的定义,下列叙述中错误的是
单选题或下面的函数调用 fun(a+b,3,max(n-1)b) 则fun 的实参个数是______。
单选题字符串“a+b=12/n/t”的长度为______。
单选题有如下类声明: class XA { int x;public: XA(int n) { x=n;}};class XB: public XA{ int y;public: XB(int a, int b);};在构造函数朋的下列定义中,正确的是( )。