beta and theta value had interchanged.Can I know where the problem is?

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

void input_from_user(double& a, double& b, double& c);//Prototype
void calculate_degree1(double& a, double& b, double& c, double& alpha, double& r1);
void calculate_degree2(double& a, double& b, double& c, double& beta, double& r2);
void calculate_degree3(double& alpha, double& beta, double& theta);
void print_results(double& alpha, double& beta, double& tetha,double& max1, double& min1);
const double PI=22/7.0;
int main()
{
cout<<fixed<<setprecision(1)<<endl;
double numberOne,numberTwo,numberThree;
double degreeOne,degreeTwo,degreeThree;
double rOne,rTwo;
double max,min;

input_from_user(numberOne,numberTwo,numberThree);
calculate_degree1(numberOne,numberTwo,numberThree,degreeOne,rOne);
calculate_degree2(numberOne,numberTwo,numberThree,degreeTwo,rTwo);
calculate_degree3(degreeOne,degreeTwo,degreeThree);
print_results(degreeOne,degreeTwo,degreeThree,max,min);

return 0;
}

void input_from_user(double& a, double& b, double& c)
{
cout<<"Enter 3 sides of a triangle.";
cin>>a>>b>>c;
}

void calculate_degree1(double& a, double& b, double& c, double& alpha,double& r1)
{
r1=(pow(a,2) + pow(b,2) - pow(c,2))/ (2*a*b);
alpha=(acos (r1)) * 180.0/PI;
}

void calculate_degree2(double& a, double& b, double& c, double& beta,double& r2)
{
r2=(pow(b,2) + pow(c,2) - pow(a,2))/ (2*b*c);
beta=(acos (r2)) * 180.0/PI;
;
}

void calculate_degree3(double& alpha, double& beta, double& tetha)
{

tetha=180-alpha-beta;
}

void print_results(double& alpha, double& beta, double& theta,double& max1, double& min1)
{
if(alpha>beta)
{
max1=alpha; min1=beta;
}
else
{
max1=beta; min1=alpha;
}
if(theta>max1)
max1=theta;
else
min1=theta;

if(alpha==max1)
{
cout<<"Alpha is "<<alpha<<" degree."<<endl;
}
else if(beta==max1)
{
cout<<"Alpha is "<<beta<<" degree."<<endl;
}
else if(theta==max1)
{
cout<<"Alpha is "<<theta<<" degree."<<endl;
}

if(alpha!=max1 || alpha!=min1)
{
cout<<"Beta is "<<alpha<<" degree."<<endl;
}
else if(beta!=max1 || beta!=min1)
{
cout<<"Beta is "<<beta<<" degree."<<endl;
}
else if(theta!=max1 || theta!=min1)
{
cout<<"Beta is "<<theta<<" degree."<<endl;
}

if(alpha==min1)
{
cout<<"Theta is "<<alpha<<" degree."<<endl;
}
else if(beta==min1)
{
cout<<"Theta is "<<beta<<" degree."<<endl;
}
else if(theta==min1)
{
cout<<"Theta is "<<theta<<" degree."<<endl;
}
}
It would appear in print_results you're attempting to "sort" the order of the angles for output. You're doing it wrong.
Can give me some suggestions to solve that? Or I need to redo the whole thing?
Topic archived. No new replies allowed.