思维导图:
作业:
#include <iostream>
using namespace std;
class Rect
{
private:
int width;
int hight;
public:
void show()
{
cout << "宽:" << width << " " << "高:" << hight << endl;
cout << "面积:" << hight*width << endl;
cout << "周长:" << 2*(hight+width) << endl;
}
void inint(int w,int h)
{
width = w;
hight = h;
}
void set_w(int w)
{
width = w;
}
void set_h(int h)
{
hight = h;
}
};
int main()
{
Rect s1;
s1.inint(3,2);
s1.set_w(10);
s1.show();
return 0;
}