Ответ:
#include<iostream>
#include<iomanip>
#define _USE_MATH_DEFINES
#include<cmath>
using namespace std;
int main()
{
double a, b, c, alfa, beta, gamma;
cout <<"a="; cin >> a;
cout <<"b="; cin >> b;
cout <<"c="; cin >> c;
if (a+b>c && a+c>b && b+c>a)
alfa = acos((b*b+c*c-a*a)/(2*b*c))*180/M_PI;
beta = acos((a*a+c*c-b*b)/(2*a*c))*180/M_PI;
gamma = acos((a*a+b*b-c*c)/(2*a*b))*180/M_PI;
cout <<"Angles in degrees:\n";
cout <<setprecision(3)<<fixed<< "alfa=" << alfa << " beta=" << beta << " gamma=" << gamma << endl;
}
else cout << "Triangle absent\n";
system("pause");
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
#include<iostream>
#include<iomanip>
#define _USE_MATH_DEFINES
#include<cmath>
using namespace std;
int main()
{
double a, b, c, alfa, beta, gamma;
cout <<"a="; cin >> a;
cout <<"b="; cin >> b;
cout <<"c="; cin >> c;
if (a+b>c && a+c>b && b+c>a)
{
alfa = acos((b*b+c*c-a*a)/(2*b*c))*180/M_PI;
beta = acos((a*a+c*c-b*b)/(2*a*c))*180/M_PI;
gamma = acos((a*a+b*b-c*c)/(2*a*b))*180/M_PI;
cout <<"Angles in degrees:\n";
cout <<setprecision(3)<<fixed<< "alfa=" << alfa << " beta=" << beta << " gamma=" << gamma << endl;
}
else cout << "Triangle absent\n";
system("pause");
return 0;
}