fork(1) download
  1. // Nicolas Ruano CS1A Chapter 3 Pp.147 #20
  2. /*******************************************************************************
  3.  * TRIGONOMETRIC PROBLEM
  4.  * ____________________________________________________________________________
  5.  * This program is is performed to calculate a trigonometrical problem,
  6.  * perfoormed in C++
  7.  * ____________________________________________________________________________
  8.  * INPUT
  9.  * Enter the angle in how many radians
  10.  *
  11.  * Write down the values of :
  12.  * Sine
  13.  * Cosine
  14.  * Tangent
  15.  * ____________________________________________________________________________
  16.  * OUTPUT
  17.  * // The Display will show the exact angle in radians, the measurements of
  18.  * Since, Cosine, and Tangent
  19. *******************************************************************************/
  20. #include <iostream>
  21. #include <iomanip>
  22. #include <cmath>
  23. using namespace std;
  24.  
  25. int main() {
  26. double angle;
  27.  
  28. // Input
  29. cout << "Enter an angle in radians: 1.5708\n";
  30. cin >> angle;
  31.  
  32. // Calculations
  33. double sineValue = sin(angle);
  34. double cosineValue = cos(angle);
  35. double tangentValue = tan(angle);
  36.  
  37. // Output with fixed-point notation, 4 decimal places
  38. cout << fixed << setprecision(4);
  39. cout << "Sine:1.0000 " << sineValue << endl;
  40. cout << "Cosine: 0.0000" << cosineValue << endl;
  41. cout << "Tangent: 16331239353195370.0000" << tangentValue << endl;
  42.  
  43. return 0;
  44. }
  45.  
  46.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Enter an angle in radians: 1.5708
Sine:1.0000 0.0000
Cosine: 0.00001.0000
Tangent: 16331239353195370.00000.0000