/*--------------------------------------------------------------------*/ /* Program problem 28 */ /* */ /* This program prints a conversion table from TF to TC. */ /* The degree values start at 0 TF, increment by 5 TF, */ /* and go through 200 degrees. */ /* The first line contains the value for zero TF and the */ /* last line contains the value for 100 TF. */ /* A do/while loop is used */ #include #include using namespace std; int main() { // Declare and initialize variables. int TF=0; double TC; // 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 << "TFs to TCs " << endl; cout << " TFs Tcs" << endl; while (TF <= 100) { TC = (TF-32) * 5.0/9.0; cout << setw(7) << TF << setw(15) << TC << endl; TF = TF +5; } // Exit program. return 0; }