思维导图
#include <iostream>
using namespace std;
class Rext
{
private:
int width;
int height;
public:
void init(int w, int h)
{
width = w;
height = h;
}
void set_w(int w)
{
width = w;
}
void set_h(int h)
{
height = h;
}
void show()
{
double s = (width * height)/2;
int length = 2*width + 2*height;
cout << "周长=" << length << endl;
cout << "面积=" << s << endl;
}
};
int main()
{
Rext s1;
s1.init(0,0);
s1.set_w(3);
s1.set_h(6);
s1.show();
return 0;
}