[单选题]

( 28 )有如下程序:

#include<iostream>

#include<cstring>

using namespace std;

class XCF{

int a;

public:

XCF ( int aa=0 ) : a ( aa ) {cout<<"1" ; }

XCF ( XCF& x ) {a=x .a; cout<<"2" ; )

~XCF () {cout<<a;}

int Geta () {return a;}

};

int main () {

XCF dl ( 5 ) , d7 ( dl ) ;

XCF *pd=new XCF ( 8 ) ;

cout<<pd 一 >Geta ( ) ;

delete pd;

return 0;

}

运行时的输出结果是

A. ) 121SS88

B. ) 12188SS

C. ) 12185

D. ) 128512

参考答案与解析:

相关试题

( 27 )有如下程序:#include<iostream>#include<c

[单选题]( 27 )有如下程序:#include<iostream>#include<cstring>using namespace std;class XCD{char* a;int b;public:XCD ( char* aa, int bb ) {a=new char[strlen ( aa ) +1];strcpty ( a,aa ) ;b=bb;}C.har* Geta () {return a; )int Getb () { return b;}};int main

  • 查看答案
  • 有如下程序:#include<iostream>#include<iomanip

    [单选题]有如下程序:#include<iostream>#include<iomanip>using namespace std;int main(){int S[]={123,234};cout<<right<<setfill(‘*’)<<setw(6);for(int i=0;i<2;i++){cout<<s[i]<<endl;}retum 0;}运行时的输出结果是A.123B.***123C.***123D.

  • 查看答案
  • 有如下程序:#include<iostream>#include<iomanip

    [单选题]有如下程序:#include<iostream>#include<iomanip>using namespace std;int main(){cout<<setw(10)<<setfill(’X’)<<setprecision(8)<<left;cout<<12.3456793<<______<<98765;return 0;}若程序的输出是12.345679x98765xxxxx,则划

  • 查看答案
  • 有如下程序:#include<iostream>#include<cstring

    [单选题]有如下程序:#include<iostream>#include<cstring>using namespace std;class XCD{char*a;int b;public:XCD(char;l:aa,int bB){a=flew char[strlen(aA)+1];strcpy(a,aA);b=bb;}char*lE Geta(){return a;}int Getb(){return b;}};int main(){char*pl=”abcd”.*p2=”w

  • 查看答案
  • 有如下程序:#include<iostream>#include<cstring

    [单选题]有如下程序:#include<iostream>#include<cstring>using namespace std;class XCF{int a;public:XCF(int aa=O):a(aA){cout<<”1”;}XCF(XCF&X){a=x.a;cout<<”2”;}~XCF(){cout<<at}int Geta(){return at}};int main(){XCF dl(5),d2(d1);XCF半pd

  • 查看答案
  • ( 34 )有如下程序:#include<iostream>#include<i

    [单选题]( 34 )有如下程序:#include<iostream>#include<iomanip>Using namespace std;int main(){int s[]={123, 234};cout<<right<<setfill('*')<<setw(6);for(int i=0; i<2; i++) { cout<<s[i]<<endl; }return 0;}运行时的输出结果是A. ) 123

  • 查看答案
  • 有如下程序:#include<iostream>#include<cmath>u

    [单选题]有如下程序:#include<iostream>#include<cmath>using std::cout;class Point{public:friend double distance(const Point &p); //P距原点的距离Point(int xx=0,int yy=0):x(xx),Y(YY){}//①private:int x,y;};double distance(const Point &p){ //②return sqrt(

  • 查看答案
  • ( 28 )有如下程序:#include<iostream>using name

    [单选题]( 28 )有如下程序:#include<iostream>using namespace std;class MyClass{public:MyClass(int x):val(x) {}void Print() const {cout<<"const:val="<<val<<'/t';}void Print(){cout<<"val="<<val<<'t';}private:int val;}

  • 查看答案
  • 有如下程序:include<iostream>usingnamespacestd

    [单选题]有如下程序:include<iostream>usingnamespacestd;classC1{public:~C1( ){cout<<1;)};classC2:publicC1{public:~C2( ){cout<<2;)};intmain( ){C.2cb2;C.1*cb1:return0;}运行时的输出结果是( )。A.121B.21C.211D.12

  • 查看答案
  • 有如下程序:include<iostream>usingnamespacestd

    [单选题]有如下程序:include<iostream>usingnamespacestd;classXA{inta;public:staticintb;XA(intaa):a(aa){b++;}~XA( ){}intget( ){returna;}};intXA::b=0intmain( ){XAd1(1),d2(3);cout<<d1.get( )+d2.get( )+XA::b<<endl;return0;}运行时的输出结果是( )。A.5B.6C.7D.8

  • 查看答案
  • ( 28 )有如下程序:#include<iostream>#include<c