Menu

[solved] – Question 96981

Write a program to display a table of sin(x) and cos(x) function values:
a sin(a) cos(a)
==============================
0.0 xxx.xxxx xxx.xxxx
30.0 xxx.xxxx xxx.xxxx
45.0 xxx.xxxx xxx.xxxx
60.0 xxx.xxxx xxx.xxxx
90.0 xxx.xxxx xxx.xxxx
——————————
where column “a” has angle values in degree; columns “sin(a)” and “cos(a)” give respective function values of each angle. The first column has a fixed width of 6 character spaces, and the angles are displayed with one decimal digit. The second and the third columns have a fixed width of 12 character spaces each, and the function values are calculated by using sin() and cos() functions from the <cmath> library and the values are displayed with four decimal digits. All columns should be right-justified.

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *