#include <iostream>
using namespace std;
class rect
{
private:
int width;
int height;
public:
void init(int width , int height);
void set_w(int width);
void set_h(int height);
void show();
};
void rect::show()
{
int c= (width + height) *2 ;
int s=width * height;
cout << c<< " ";
cout << s<< endl;
}
void rect::init(int width, int height)
{
this -> width=width;
this -> height=height;
}
void rect::set_w(int width)
{
this -> width=width;
}
void rect :: set_h(int height)
{
this -> height=height;
}
int main()
{
rect rec;
rec. init (3,4);
rec.show();
rec.set_w(7);
rec.show();
rec.set_h(10);
rec.show();
return 0;
}
QT day 2
于 2023-10-08 20:06:31 首次发布