ในปัญหานี้ เราได้รับค่าที่แสดงถึงด้านข้างของ icosahedron งานของเราคือการสร้างโปรแกรมเพื่อค้นหาพื้นที่และปริมาตรของ Icosahedronin C++
ไอโคซาเฮดรอน เป็นรูปทรงหลายเหลี่ยม 30 ด้านปกติ มีสามเหลี่ยมด้านเท่า 20 รูปด้านเดียวกัน มีจุดยอดเพียง 12 จุดของรูปทรงหลายเหลี่ยมนี้

เส้นประใช้สำหรับขอบที่อยู่ด้านหลังพื้นผิวที่มองเห็นได้
มาดูตัวอย่างเพื่อทำความเข้าใจปัญหากัน
อินพุต
a = 4
แนวทางการแก้ปัญหา
ในการแก้ปัญหา เราจะใช้สูตรเรขาคณิตเพื่อหาพื้นที่ของไอโคซาเฮดรอน
พื้นที่ผิว (พื้นที่) =$5\square^2\sqrt{3}=8.660 * a^2$
ปริมาณ =$ปริมาณ =\frac{5\square^2}{12}(3+\sqrt{5})=2.1817 * a^3$
โปรแกรมเพื่อแสดงการทำงานของโซลูชันของเรา
ตัวอย่าง
#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