I have to do the following:
1. Create a program that will convert from Celsius to Fahrenheit. The user will input a value in Celsius (Integer) and the program will display the temperature converted to Fahrenheit (Integer).
MY answer is:
#include <iostream.h>
#include <stdlib.h>
void main()
{
float Fahrenheit;
float Celsius;
cout<< "Temperature Converter\n"
<< "_____________________\n\n";
cout<< "Fahrenheit \t Celsius.\n";
for(Fahrenheit = -50; Fahrenheit <= 250; Fahrenheit+=10) {
Celsius = 5* (Fahrenheit - 32)/9;
cout<< Fahrenheit << "F\t-\t" << Celsius << 'C' << endl;
system("PAUSE");
}
cout<< "Celsius \t Fahrenheit.\n";
for(Celsius = -50; Celsius <= 150; Celsius+=5) {
Fahrenheit = ((float)9/5) * Celsius + 32;
cout<< Celsius << "C\t-\t" << Fahrenheit << 'F' << endl;
system("PAUSE");
}
cout<< endl << "End of Temperature conversions.\n";
// Pause program before exiting (for non VisualC++ compiler only).
system("PAUSE");
} // end main.
I HAVE TO DO THE FOLLOWING WITH THE ABOVE:
1. Modify the program from above to allow the user to continue entering Celsius temperatures until the user enters a sentinel value (you can determine what that sentinel value will be).
2. Create a function to retrieve the values from the user until the sentinel value is entered. The function will return the average of the values entered as an integer.
3. From the main function, call the function you created to retrieve the values and return the average. Then convert that average to Fahrenheit and display the results.
I AM HAVING SOME DIFFICULTY IN MODIFYING THE PROGRAM, I WOULD LIKE TO KNOW IF ANYONE WOULD LIKE TO ASSIST ME IF YOU COULD.
I REALLY APPRECIATE ALL OF YOUR HELP.I AM REALLY NEW TO C++, NOW LEARNING ON MY OWN.
Thanks
Nazma