/*--------------------------------------------------------------------*/ /* Program chapter3_2 */ /* */ /* This program prints a conversion table from degrees to radians. */ /* The degree values start at 0 degrees, increment by 10 degrees, */ /* and go through 360 degrees. */ /* The first line contains the value for zero degrees and the */ /* last line contains the value for 360 degrees. */ /* A do/while loop is used */ #include #include using namespace std; const double PI = 3.141593; int main() { // Declare and initialize variables. int degrees=0; double radians; // Set formats cout.setf(ios::fixed); cout.precision(3); /* Formatting the output is optional. But it is nice to have a table printed with format */ // Print title and table cout << "Degrees to Radians " << endl; cout << " Degrees Radians" << endl; do { radians = degrees *PI/180.0; cout << setw(7) << degrees << setw(15) << radians << endl; degrees = degrees + 10; } while (degrees <= 360); // Exit program. return 0; }