/*********************************************** * * * * * CSCI 1470, Fall 2005 * * Machine Problem: MP * * Purpose: Convert Celsius to Fahrenheit * * a user defined amount if times for * * user defined increments. * ***********************************************/ #include #include using namespace std; int main(void) { //Declare variable double celsius, fahrenheit, increment; int conversion, while_test; //Get input from user cout << "Enter Starting Celsius Temperature: "; cin >> celsius; cout << "Enter Number of Conversions: "; cin >> conversion; cout << "Enter Increment: "; cin >> increment; //Display top of table cout << "-------------------------------------------------------------------------------" << endl; cout << "Conversion# Celsius Fahrenheit " << endl; cout << "-------------------------------------------------------------------------------" << endl; //Initialize for the while loop while_test = 1; //While loop that runs the user defined number of times while(while_test <= conversion) { //Converts celsius to fahrenheit fahrenheit = (9.0 / 5.0) * celsius + 32.0; //Display calculations cout << " " << while_test << " " << setprecision(2) << fixed << celsius << " " << fahrenheit << endl; //Updates the while_test while_test = while_test + 1; //Updates celsius by the users increment celsius = celsius + increment; }//end of while loop //Bottom of table cout << "-------------------------------------------------------------------------------" << endl << endl; return 0; }//end of function main