Hi, I have written the below code and to finish my assignment I need to have this file save to "results.txt" and I also need the angles to come out as degrees in the output..I've tried several tutorials and I am really struggling with this..any help would be appreciated

``````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;
cout<<"Enter value of angle 1 and side opposite of angle"<<endl;
cin>>angle1>>side1;
if (angle1>90)
{
cout<<"error: angle cannot be greater than 90"<<endl;
}
if (angle1<=90)
{
side3=(side1)/(sin(angle1));
side2=(side1)/(tan(angle1));
cout<<"Side 2="<<side2<<endl;
cout<<"Side 3="<<side3<<endl;
angle2=(PI/2)-(angle1);
angle3=(PI/2);
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;
}

system("pause");
return 0;
}``````

I've tried a few things, I used the "tofile" command, and when I did this I no longer received the info in my DOS program, only in my results file, which I have been able to figure out...still struggling with radians to degrees

OK, I am all set with printing to a file my only problem now is converting my angles to degrees in the output...sorry to keep responding to my own thread

Is this the same problem as your other thread? If so, please close this one so people will know which thread to respond to. I just responded to your other thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.