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

Fn Programming (Email the C++ code) 10 BUILT-IN FUNCTIONS Filename: A3ques10.cpp

ID: 3736155 • Letter: F

Question

Fn Programming (Email the C++ code) 10 BUILT-IN FUNCTIONS Filename: A3ques10.cpp Write a C++program that calls built-in functions sin and cos. The program prints a table of sin and cos for every degree from 10 to 30. The argument being passed to sin and cos must be double and it must be in radians. 0 Radians are related to degrees by the following equation: degrees radians 180 Suggested screen design: sin Degrees 10 2 coo 0.98 0.98 0.97 0.97 0.97 0.96 0.21 0.22 0.24 0.26 0.28 0.29 0.31 0.33 0.34 0.36 0.37 8.39 14 19 20 0.95 0.93 0.93 0.92 23 0.91 0.9 0.89 0.88 0.87 0.87 Press any key to continue . . 25 26 27 28 29 30 0.44 0.45 48 0.5

Explanation / Answer

#include <iostream>

#include <cmath>

using namespace std;

int main() {

double rad, pi = 22 / 7;

cout << "Degrees" << " "<< " Sin" << " "<< " Cos" << endl;

for (int degrees = 10; degrees <= 30 ; degrees++)

{

rad = (degrees * 3.14) / 180;

cout << degrees << " " << sin(rad) << " " << cos(rad) << endl;

}

return 0;

}

/****************** Output of Program ******************

Degrees Sin Cos

10 0.173561 0.984823

11 0.190713 0.981646

12 0.207808 0.97817

13 0.224839 0.974396

14 0.241802 0.970326

15 0.258691 0.96596

16 0.275501 0.961301

17 0.292228 0.956349

18 0.308866 0.951106

19 0.325409 0.945573

20 0.341854 0.939753

21 0.358194 0.933647

22 0.374426 0.927257

23 0.390544 0.920584

24 0.406543 0.913632

25 0.422418 0.906401

26 0.438164 0.898895

27 0.453778 0.891115

28 0.469253 0.883064

29 0.484585 0.874744

30 0.49977 0.866158

**********************************************/