Home > Backend Development > C++ > body text

In a C program, translate the following into Chinese: What is the area of ​​a square inscribed in a circle inscribed in an equilateral triangle?

WBOY
Release: 2023-08-31 12:25:08
forward
1012 people have browsed it

Here we will see that the area of ​​a square is inscribed in a circle, and that the circle is inscribed in an equilateral triangle. The side of the square is "a". The radius of the circle is "r" and the side of the hexagon is "A". The chart is shown below.

In a C program, translate the following into Chinese: What is the area of ​​a square inscribed in a circle inscribed in an equilateral triangle?

#We know that the radius of the inscribed circle of an equilateral triangle is the inner radius of the triangle. So the value is -

In a C program, translate the following into Chinese: What is the area of ​​a square inscribed in a circle inscribed in an equilateral triangle?

so the diagonal of the square is -

In a C program, translate the following into Chinese: What is the area of ​​a square inscribed in a circle inscribed in an equilateral triangle?

so the area of ​​the square is -

In a C program, translate the following into Chinese: What is the area of ​​a square inscribed in a circle inscribed in an equilateral triangle?

Example

#include <iostream>
#include <cmath>
using namespace std;
float area(float A) { //A is the side of the triangle
   if (A < 0) //if the value is negative it is invalid
      return -1;
   float d = A / sqrt(3);
   float area = 0.5*d*d;
   return area;
}
int main() {
   float side = 10;
   cout << "Area is: " << area(side);
}
Copy after login

Output

Area is: 16.6667
Copy after login

The above is the detailed content of In a C program, translate the following into Chinese: What is the area of ​​a square inscribed in a circle inscribed in an equilateral triangle?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template