求矩形的周长和面积
怎么改这个代码
#include<iostream>
using namespace std;
class juxing
{
int a,b;
double s,c;
public:
juxing(){};
juxing(int new_a)
{
a=new_a;
b=new_a;
}
juxing(int new_a,int new_b)
{
a=new_a;
b=new_b;
}
juxing(juxing &d)
{
a=d.a;
b=d.b;
}
double gets()
{
s=a*b;
return s;
}
double getc()
{
c=2*a+2*b;
return c;
}
};
int main()
{
juxing A1,A2(2),A3(5,3),A4(A3);
cout<<A1.getc()<<" "<<A1.gets()<<endl;
cout<<A2.getc()<<" "<<A2.gets()<<endl;
cout<<A3.getc()<<" "<<A3.gets()<<endl;
cout<<A4.getc()<<" "<<A4.gets()<<endl;
return 0;
}