Ok, This program is designed to output sides and angles of a triangle based upon a side and angle that is inputted by the user. When I run the program the lenghts of the sides that I receive make absolutely no sense..but when I do them in my calculator they work out perfectly..I have bolded the two lines that have been giving me trouble, I'm at witts end trying to figure out why the heck this isn't working!
using namespace std;
#include<iostream>
#include<cmath>
#include<iomanip>
#include<fstream>
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
int main()
{
double angle1, side1, angle2, side2, angle3, side3, PI= 4.0*atan(1.0), perimiter, area;
ofstream tofile ("Results.txt");
cout<<"Enter value of angle 1 and side opposite of angle"<<endl;
cin>>angle1>>side1;
if (angle1>(PI/2)*(180/PI))
{
cout<<"error: angle cannot be greater than 90"<<endl;
}
if (angle1<=(PI/2)*(180/PI))
{
[B]side3=(side1)/(sin(angle1));
side2=(side1)/(tan(angle1));[/B]
cout<<"Side 2="<<side2<<endl;
cout<<"Side 3="<<side3<<endl;
angle2=((PI/2)*(180/PI))-(angle1);
angle3=((PI/2)*(180/PI));
cout<<"Angle 2="<<angle2<<endl;
cout<<"Angle 3="<<angle3<<endl;
perimiter=(side1)+(side2)+(side3);
cout<<"Perimiter="<<perimiter<<endl;
area=((side1*side2)/2);
cout<<"Area="<<area<<endl;
}
if (area>100)
{
cout<<"this is a large triangle"<<endl;
}
tofile<<"Side 2="<<side2<<endl;
tofile<<"Side 3="<<side3<<endl;
tofile<<"Angle 2="<<angle2<<endl;
tofile<<"Angle 3="<<angle2<<endl;
tofile<<"Area="<<area<<endl;
tofile<<"Perimiter="<<perimiter<<endl;
system("pause");
return 0;
}