这里我们将了解如何获取直角三角形的外接圆面积。三角形的斜边形成圆的直径。因此,如果斜边为 h,则半径为 h/2

所以面积为 -
示例代码
#include <iostream>
#include <cmath>
using namespace std;
float area(float h) {
if (h < 0) //if h is negative it is invalid
return -1;
float area = 3.1415 * (h/2) * (h/2);
return area;
}
int main() {
float h = 8;
cout << "Area : " << area(h);
}输出
Area : 50.264










