Plot cos(x) with characters
- Design a program which will shows the value of x and cos(x), and
indicate the position of cos(x) with spaces and '*'.
- You may need to format the output with setw(), setprecision(),
std::fixed and std::showpos.
The output of the program may look like follows.
0 0.00000 +1.00000 *
15 0.26180 +0.96593 *
30 0.52360 +0.86603 *
45 0.78540 +0.70711 *
60 1.04720 +0.50000 *
75 1.30900 +0.25882 *
90 1.57080 +0.00000 *
105 1.83260 -0.25882 *
120 2.09440 -0.50000 *
135 2.35619 -0.70711 *
150 2.61799 -0.86603 *
165 2.87979 -0.96593 *
180 3.14159 -1.00000 *
195 3.40339 -0.96593 *
210 3.66519 -0.86603 *
225 3.92699 -0.70711 *
240 4.18879 -0.50000 *
255 4.45059 -0.25882 *
270 4.71239 -0.00000 *
285 4.97419 +0.25882 *
300 5.23599 +0.50000 *
315 5.49779 +0.70711 *
330 5.75959 +0.86603 *
345 6.02139 +0.96593 *
360 6.28319 +1.00000 *