主观

完成程序,使其结果为x=6,y=10x=11,y=10

#include ﹤iostream.h﹥

using namespace std;

class Sample

{

private:int x;

_____________;

public:

Sample (int a);

void print( );

};

Sample:

Sample( _____________ )

{

 x=a; y=x++;

}

void Sample:: print( )

{

cout ﹤﹤"x="﹤﹤x﹤﹤",y="﹤﹤y﹤﹤end;

}

int Sample: : y =25;

void main( )

{

 Sample s1(5);

Sample s2(10);

s1. print( );

s2. print( );

}

参考答案
您可能感兴趣的试题
¥

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服