1、思维导图
https://www.zhixi.com/view/9e899ee0
2、作业
#include <iostream>using namespace std;class Rect
{int width;int height;
public:void init(int w,int h);//初始化函数void set_w(int w);//更改宽度void set_h(int h);//更改高度void show();//输出矩形周长和面积
};void Rect::init(int w,int h)
{this -> width = w;this -> height = h;
}void Rect::set_w(int w)
{this -> width = w;
}void Rect::set_h(int h)
{this -> height = h;
}void Rect::show()
{int llong,aarea;llong=2*(this->width + this->height);aarea=(this->width)*(this->height);cout << "长方形周长为:" << llong << endl;cout << "长方形面积为:" << aarea << endl;
}int main()
{Rect s1;s1.init(5,10);s1.show();return 0;
}