①XMind

②矩形计算(代码)
//SqrCalc.cpp
//矩形计算
#include
using namespace std;
class Rect
{
private:
int wight;
int high;
int pre;
int area;
public:
void init(int wight, int hight);
int set_w();
int set_h();
void show();
};
void Rect :: init(int wight, int hight)
{
this-> wight = wight;
this-> high = hight;
}
int Rect :: set_w()
{
cout << "请输入宽度w= ";
cin >> wight;
return wight;
}
int Rect :: set_h()
{
cout << "请输入高度h= ";
cin >> high ;
return high;
}
void Rect :: show()
{
pre = (wight+high)*2;
area = wight*high;
cout << "该矩形的周长: " << pre < cout << "该矩形的面积:" << area << endl; } void main() { int w=0, h=0; Rect r; w = r.set_w(); h = r.set_h(); r.init(w, h); r.show(); return ; } ②矩形计算(输出)