Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part D: Trigonometric Table Using the C++ math functions of sin, cos, and tan pr

ID: 3843185 • Letter: P

Question

Part D: Trigonometric Table Using the C++ math functions of sin, cos, and tan produce a formatted table of Sine, Cosine, and Tangent. The table should go from 0 to 360-degrees in steps of 10-degrees. You will need to use a loop for this homework. To use the math functions please add the following include file to the top of your source file: #include : #include Kiomanip> to include these functions and flags. You will be using the fixed, noshowpoint, showpoint, setw, and setprecision flags. Here are some examples. To output a float/double number with a fixed width of eight and four digits after the decimal point use the following: double x 1243.333333; cout fixed setw(8) setprecision(4) x end

Explanation / Answer

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
const double PI = 3.14159;
int main()
{
   double angle_in_radians;
  
   cout << "Degrees       Sine           Cosine           Tangent"<<endl;
   for (int i = 0; i < 360; i = i + 10)
   {
       angle_in_radians = i *PI / 180.0;
       cout << left << setw(3) << left << i << " "<<setw(10) << setprecision(4) << sin(angle_in_radians) << " " << left << setw(10) << setprecision(4) << cos(angle_in_radians) << " " << left << setw(25) << setprecision(4) << tan(angle_in_radians) << endl;

   }

}

---------------------------------------------------------

//output

Degrees Sine Cosine Tangent
0 0 1 0

10 0.1736 0.9848 0.1763

20 0.342 0.9397 0.364

30 0.5 0.866 0.5773

40 0.6428 0.766 0.8391

50 0.766 0.6428 1.192

60 0.866 0.5 1.732

70 0.9397 0.342 2.747

80 0.9848 0.1736 5.671

90 1 1.268e-006 7.889e+005

100 0.9848 -0.1736 -5.671

110 0.9397 -0.342 -2.747

120 0.866 -0.5 -1.732

130 0.766 -0.6428 -1.192

140 0.6428 -0.766 -0.8391

150 0.5 -0.866 -0.5774

160 0.342 -0.9397 -0.364

170 0.1737 -0.9848 -0.1763

180 2.535e-006 -1 -2.535e-006

190 -0.1736 -0.9848 0.1763

200 -0.342 -0.9397 0.364

210 -0.5 -0.866 0.5773

220 -0.6428 -0.766 0.8391

230 -0.766 -0.6428 1.192

240 -0.866 -0.5 1.732

250 -0.9397 -0.342 2.747

260 -0.9848 -0.1737 5.671

270 -1 -3.803e-006 2.63e+005

280 -0.9848 0.1736 -5.671

290 -0.9397 0.342 -2.748

300 -0.866 0.5 -1.732

310 -0.766 0.6428 -1.192

320 -0.6428 0.766 -0.8391

330 -0.5 0.866 -0.5774

340 -0.342 0.9397 -0.364

350 -0.1737 0.9848 -0.1763

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote