Question: Write a C++ program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on the users choice. ( You must use multiple functions in
Write a C++ program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on the users choice. (You must use multiple functions in your source code to receive a grade for this assignment.)
Use main( ) as the driver function. main( ) should allow the user to run the program as many times as desired.
Write the function getConvertChoice( ) to prompt the user for the desired conversion:
Celsius to Fahrenheit
Fahrenheit to Celsius.
Return this value back to main( ).
Write the function getTemperature( ) to prompt the user for the temperature in degrees to be converted.
Depending on the users conversion choice (hint: use an if-else or switch statement in main()): 1) call the function convertToFahren( ), if the user chose to convert from Celsius to Fahrenheit, or 2) call the function convertToCelsius( ) if the user chose to convert from Fahrenheit to Celsius. The formulas are: Fahrenheit = (9.0/5.0) * Celsius + 32.0
Celsius = (5.0/9.0) * (Fahrenheit 32.0)
Write the function displayConversion( ) to display the original temperature entered and the converted temperature with appropriate messages. Display the values to a tenth of a decimal.
Sample I/O:
Please choose the desired conversion from the menu.
1. Convert from Celsius to Fahrenheit.
2. Convert from Fahrenheit to Celsius.
Enter choice: ? 1
Please enter the temperature to be converted: ? 0
The temperature entered in Celsius is: 0.0
The temperature converted to Fahrenheit is: 32.0
Would you like to convert another temperature? Y or N y
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
