//Faith Tjia CSC5 Chapter 3, P. 147, #20
//
/*****************************************************************************
* ANGLE CALCULATOR
* ___________________________________________________________________________
* This program will ask the user to enter an angle (in radians), it will then
* calculate and display the sine, cosine, and tangent of the angle.
*
* FUNCTIONS USED
* sin(x), cos(x), tan(x)
* ___________________________________________________________________________
* INPUT
* angle: The angle given by the user
*
* OUTPUT
* sinA
* cosA
* tanA
*
* **************************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main( ) {
double angle; //INPUT - The angle given by the user
double sinA; //OUTPUT - The sine of the angle
double cosA; //OUTPUT - The cosine of the angle
double tanA; //OUTPUt - The tangent of the angle
//
// Initialize Program Variables
cout << "Enter an angle in the form of radians: " ;
cin >> angle;
cout << angle << endl;
//
// Compute Sine, Cosine, and Tangent
double sinA = sin ( angle) ;
double cosA = cos ( angle) ;
double tanA = tan ( angle) ;
//
// Display Sine, Cosine, and Tangent of the Angle
cout << "The sine of the angle is " << setprecision( 4 ) << fixed << sinA <<
endl;
cout << "The cosine of the angle is " << setprecision( 4 ) << fixed << cosA
<< endl;
cout << "The tangent of the angle is " << setprecision( 4 ) << fixed << tanA
<< endl;
return 0 ;
}
Ly9GYWl0aCBUamlhCQkJCQlDU0M1CQkJCUNoYXB0ZXIgMywgUC4gMTQ3LCAjMjAKLy8KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqIEFOR0xFIENBTENVTEFUT1IKICogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCiAqIFRoaXMgcHJvZ3JhbSB3aWxsIGFzayB0aGUgdXNlciB0byBlbnRlciBhbiBhbmdsZSAoaW4gcmFkaWFucyksIGl0IHdpbGwgdGhlbiAKICogY2FsY3VsYXRlIGFuZCBkaXNwbGF5IHRoZSBzaW5lLCBjb3NpbmUsIGFuZCB0YW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