#include <iostream>
using namespace std;
class Rect{
double width;
double height;
public:
void set_w(double w){
width = w;
}
void set_h(double h){
height = h;
}
void show(){
cout << "矩形面积为:" << width*height << endl;
}
};
int main()
{
double w,h;
Rect r;
cout << "请输入宽度:" << endl;
cin >> w;
r.set_w(w);
cout << "请输入高度:" << endl;
cin >> h;
r.set_h(h);
r.show();
return 0;
}
20240530
最新推荐文章于 2024-07-25 21:13:04 发布