在这里,我们将看到一个内接于菱形的圆的面积。菱形的对角线分别为'a'和'b'。圆的半径为h。
两条对角线形成了四个相等的三角形。每个三角形都是直角三角形,因此它们的面积是-
菱形的每条边都是斜边-
因此,圆的面积为-
#include <iostream> #include <cmath> using namespace std; float area(float a, float b) { if (a < 0 || b < 0) //if the values are negative it is invalid return -1; float area = (3.1415 * (a*b * a*b))/(4 * (a*a + b*b)); return area; } int main() { float a = 8, b= 10; cout << "Area is: " << area(a, b); }
Area is: 30.6488
以上就是在C程序中,圆内接于菱形的面积是多少?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号