#include <iostream>#include <stdlib.h>using namespace std;class Rectangle{ double length; double wide; public: void Set_lengthandwide(double a,double b) {length=a,wide=b;} double Get_Girth() { return length+length+wide+wide;} double Get_Area() { return length*wide;}};int main(){ Rectangle A; double a,b; A.Set_lengthandwide(a,b); cout << "请输入长方形的长和宽:\n"; cin >> a >> b; cout << "长方形的周长和面积为:\n"; cout << "A.Girth=" <<A.Get_Girth() << endl; cout << "A.Area=" <<A.Get_Area() << endl; return 0;}
1 回答
- 1 回答
- 0 关注
- 730 浏览
添加回答
举报
0/150
提交
取消