Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C++

โปรแกรมคำนวณพื้นที่ผิว Dodecahedron ใน C++


What is Dodecahedron?

คำว่า 'dodecahedron' มาจากคำ希臘 dodeca หมายถึง 'twelve' และ hedron หมายถึง 'faces' Dodecahedron คือ 3-D platonic solid ที่มี 12 ผิวแบน คุณสมบัติ −

  • 20 polyhedron vertices
  • 30 polyhedron edges
  • 12 pentagonal faces (pentagon คือรูปห้าเหลี่ยม)

ภาพ Dodecahedron

โปรแกรมคำนวณพื้นที่ผิว Dodecahedron ใน C++

ปัญหา

ให้ขอบ (edge) หาพื้นที่ผิว Dodecahedron

สูตร −

โปรแกรมคำนวณพื้นที่ผิว Dodecahedron ใน C++

ตัวอย่าง

Input-: side=5 Output-: 516.143

ALGORITHM

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

CODE

#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