// ;----------------------------------------------------------- // ; Program Name: Class_Demo // ; File: demoprob20.cpp // ; Description: Demos some of the trig functions // ; Author: Jim Adams // ; Environment: MS C++ 6.0 // ; Date Written: 10/13/2001 // ;----------------------------------------------------------- #include #include #include void main() { int counter=0; double x=0.0; // degrees double rad=0.0; // radians cout << "Degrees Sine Cosine Tangent Cotangent" << endl; // Print the Sine Detail cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(4); for (x=0.0; x<=90.0; x=x+5) { rad = x * 3.14159 / 180.0; // convert degrees to radians cout.setf(ios::fixed); cout.unsetf(ios::showpoint); cout.precision(0); cout << setw(7) << x; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(3); cout << setw(10) << sin(rad); cout << setw(10) << cos(rad); cout << setw(10) << tan(rad); cout << setw(10) << 1/tan(rad); cout << endl; } cout << endl; }