下面程序的结果是 #include<iostream.h> class test{ private: int num; public: test( ); int getint( ) {return num;} ~test( );}; test::test( ) { num=0;} test::~test( ) { cout<<"Destructor is active"<<endl;} void
A.Exiting main Destructor is active Destructor is active Destructor is active
B.Exiting main Destructor is active Destructoris active
C.Exiting main Destructoris active
D.Exiting main
第1题:
下面程序的结果是( )。#include<iostream.h>void main(){char *str;str="test!";cout<<str[5];}
A.程序错误
B.!
C.'\0'
D.为空字符
第2题:
下面程序的运行结果为 #include<iostream.h> class A { int num; public: A(int){num=i;} A(ABm){num=a.num++;} void print(){cout<<num;} }; void main() { Aa(1),b(a); a.print(); b.print(); }
A.11
B.12
C.21
D.22
第3题:
如下程序编译时发生错误,错误的原因是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( );
}
第4题:
下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueY
A.5 0 6 4
B.0 0 6 4
C.5 0 6 2
D.0 0 6 2
第5题:
下面程序的运行结果是 #include<iostream.h> void main() { int num=1; int &ref=num; ref=ref+2; cout<<num; num=num+3; cout<<ref<<end1; }
A.13
B.16
C.36
D.33