Heim > Backend-Entwicklung > C++ > Hauptteil

在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?

王林
Freigeben: 2023-09-05 21:33:09
nach vorne
871 人浏览过

Here we will see the area of a square which in inscribed in one circle and that circle is inscribed in a hexagon. The side of the square is ‘a’. The radius of the circle is ‘r’, and the side of the hexagon is ‘A’. The diagram will be like below.

在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?

We know that the radius of a circle inscribed in a hexagon is −

在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?

Also the radius of the circle is half of the diagonal of the square. So −

在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?

Then we can say −

在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?

Then the area will be −

在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?

Example

#include 
#include 
using namespace std;
float area(float A) { //A is the side of the hexagon
   if (A < 0) //if the value is negative it is invalid
      return -1;
   float area = (A*A) * float(3.0/2.0);
   return area;
}
int main() {
   float side = 5;
   cout << "Area is: " << area(side);
}
Nach dem Login kopieren

输出

Area is: 37.5
Nach dem Login kopieren

以上是在C程序中,将以下内容翻译为中文:正六边形内切的圆中内切的正方形的面积是多少?的详细内容。更多信息请关注PHP中文网其他相关文章!

Quelle:tutorialspoint.com
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!