面积和周长得出的结果是错的,怎么改

#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;
}

TiAmo_YF
浏览 705回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP