主观

在下面程序横线处填上适当内容,使程序执行结果为:  n=2,sum=2  n=3,sum=5  n=5,sum=10  程序如下:

#include ﹤iostream.h﹥

class Test

{

int n;

static int sum;

public:

Test(int x){n=x;}

void add( ){_________;}

void disp( )

{

cout﹤﹤{"n="﹤﹤n﹤﹤",sum="﹤﹤sum﹤﹤endl;

}

} ;

int _________=0;

void main( )

{

Test a(2),b(3),c(5);

a.add( );

a.disp( );

b.add( );

b.disp( );

c.add( );

c.disp( );

}

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

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服