C++ 中求二十面体的表面积和体积的程序
在这个问题中,我们给出一个值,表示二十面体的边长。我们的任务是创建一个程序,用 C++ 语言求出二十面体的表面积和体积。
二十面体是具有 30 个面的正多面体。它有 20 个相等的等边三角形,只有 12 个顶点。

虚线表示位于可见表面后面的边。
我们以一个例子来理解这个问题,
输入
a = 4
程序说明了我们解决方案的工作原理,
示例
#include <iostream>
using namespace std;
float calcIcoSArea(float a) {
return (8.660 * a * a);
}
float calcIcoVolume(float a) {
return (2.1817 * a * a * a);
}
int main(){
float a = 7;
cout<<"The length of side of icosahedron is "<<a<<endl;
cout<<"The surface area of icosahedron is "<<calcIcoSArea(a)<<endl;
cout<<"The volume of icosahedron is "<<calcIcoVolume(a)<<endl;
return 0;
}输出
The length of side of icosahedron is 7 The surface area of icosahedron is 424.34 The volume of icosahedron is 748.323
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP