/************************************************************************ * Program: F to C converter * * Programmer: Dan Bennett * * Date: Oct 4, 2001 * * * * This program will prompt the user for the temprature in Fahrenheit * * and calculate the temprature in Celsius * * The formula C = 5/9(f-32) is used * ************************************************************************/ #include #include // gives us setw and setprecision using namespace std; float convert_f_to_c(float); void print_temps(float, float); int main () { float tempinf, // the temprature in f. tempinc; // the calculated temprature // used fixed point and show the decimal point in floats cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint); cout << setprecision(2); cout << "Temprature in F C" << endl; tempinf=0; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); tempinf= tempinf + 10; tempinc = convert_f_to_c(tempinf); print_temps(tempinf,tempinc); return(0); }