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

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


What is Octahedron?

คำว่า 'dodecahedron' มาจากคำ希臘 Octa หมายถึง 'Eight' และ hedron หมายถึง 'faces' Octahedron ในเรขาคณิตคือ 3-D platonic หรือ regular solid ที่มี 8 ผิว คุณสมบัติ −

  • 6 polyhedron vertices
  • 12 polyhedron edges
  • 8 equilateral faces

ภาพ Octahedron

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

ปัญหา

ให้ด้านของ Octahedron หาพื้นที่ผิว พื้นที่ผิวคือพื้นที่รวมของทุกผิว

สูตร −

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

โดย a คือด้านของ Octahedron

ตัวอย่าง

Input-: side=5 Output-: 86.6025

อัลกอริทึม

Start Step 1 -> declare function to find area of octahedron   double surface_area(double side)     return (2*(sqrt(3))*(side*side)) Step 2 -> In main()   Declare variable double side=5   Print surface_area(side) Stop

ตัวอย่าง

#include <bits/stdc++.h> using namespace std; //function for surface area of octahedron double surface_area(double side){   return (2*(sqrt(3))*(side*side)); } int main(){   double side = 5;   cout << "Surface area of octahedron is : " << surface_area(side); }

ผลลัพธ์

Surface area of octahedron is : 86.6025