#include <iostream>
using namespace std;
class Rect
{
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()
    {
        //cout << "width=" << w << endl;
        //cout << "height=" << h << endl;
        cout << "面积=" << width*height << endl;
        cout << "周长=" << (width+height)*2 << endl;
    }
};
int main()
{
    Rect s1;
    s1.init(8,9);
    s1.set_h(10);
    s1.set_w(10);
    s1.show();
    return 0;
}
思维导图:











