主观

在下面程序中的下划线处填上适当的程序,使程序的输出结果如下:x=1,y=2x=30,y=40源程序如下:

#include ﹤ iostream﹥

class Sample{

int x,y;

public:

Sample( ){x=y=0;}

Sample(int i,int j){x=i;y=j;}

void copy(Sample & s);

void setxy(int i,int j){x=i;y=j;}

void print( ){cout﹤﹤"x="﹤﹤x﹤﹤",y="﹤﹤y﹤﹤endl;

};

void Sample::copy ( _________ )

{

x=s.x; y=s.y;

}

void func( _________ )

{

s1.setxy(10,20);

s2.setxy(30,40);

}

void main( )

{

Sample p(1,2),q;

q.copy(p);

func(p,q);

p.print( );

q.print( );

}

Sample&s

}

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

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服