Вычислить площадь правильного N–угольника, в который вписана окруж-
ность диаметра D. Найти относительные ошибки замены площади такого N–угольника
площадью круга при значениях N, равных 12, 120, 720. Проверить правильность реше-
ния: при N=4 и любом D относительная ошибка должна быть равна 0,274.
Написать программу в С++
Ответы на вопрос
Ответил Khaker1999
0
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int
numOfSides,
diameter;
double
polygonArea;
cout << "Input number of sides: ";
cin >> numOfSides;
cout << "Input the diameter of the inscribed circle: ";
cin >> diameter;
polygonArea = numOfSides * (diameter * diameter / 4) * tan(PI / numOfSides);
cout << "Polygon area = " << polygonArea << ";nDelta = "
<< 1 - (PI * (diameter * diameter / 4)) / polygonArea << endl;
system("pause");
return 0;
} /* End of the 'main' function */
#include <cmath>
using namespace std;
int main()
{
int
numOfSides,
diameter;
double
polygonArea;
cout << "Input number of sides: ";
cin >> numOfSides;
cout << "Input the diameter of the inscribed circle: ";
cin >> diameter;
polygonArea = numOfSides * (diameter * diameter / 4) * tan(PI / numOfSides);
cout << "Polygon area = " << polygonArea << ";nDelta = "
<< 1 - (PI * (diameter * diameter / 4)) / polygonArea << endl;
system("pause");
return 0;
} /* End of the 'main' function */
Новые вопросы
Математика,
2 года назад
Математика,
2 года назад
Математика,
8 лет назад
Химия,
8 лет назад
Математика,
9 лет назад