用於計算十二面體的表面積的 C++ 程式
什麼是十二面體?
單詞‘十二面體’源自希臘語,其中十二面體表示‘十二’,而 hedra 表示‘面’。在幾何中,十二面體是具有十二個平面的 3D 柏拉圖或規則立體。與其他圖形一樣,十二面體也具有以下性質: -
- 20 個多面體頂點
- 30 條多面體邊
- 12 個五角面,五角形是五邊形
下面給出的是十二面體的影像

問題
給定一個稜,該程式必須找到十二面體的表面積,其中表面積是給定圖形的面佔用的總空間。
為了計算十二面體的表面積,有一個公式,即:

示例
Input-: side=5 Output-: 516.143
演算法
Start Step 1 -> declare function to find area of dodecahedron double area(int side) return ((3 * sqrt(25 + 10 * (sqrt(5)))) * (pow(side, 2))) Step 2 -> In main() Declare variable int side=5 Print area(side) Stop
程式碼
#include <bits/stdc++.h>
using namespace std;
//function to find area of dodecahedron
double area(int side){
return ((3 * sqrt(25 + 10 * (sqrt(5)))) * (pow(side, 2))) ;
}
int main(){
int side = 5;
cout<< "Surface area of dodecahedron is : " << area(side);
return 0;
}輸出
Surface area of dodecahedron is : 516.143
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP