Question: C++ // Program Convert converts a temperature from Fahrenheit to // Celsius or a temperature from Celsius to Fahrenheit // depending on whether the user

C++

// Program Convert converts a temperature from Fahrenheit to // Celsius or a temperature from Celsius to Fahrenheit // depending on whether the user enters an F or a C.

#include using namespace std;

int ConvertedTemp(int tempIn, char letter); // If letter is a 'C,' tempIn is converted from Celsius // to Fahrenheit; otherwise tempIn is converted from // Fahrenheit to Celsius.

int main () { char letter; // Place to store input letter int tempIn; // Temperature to be converted

cout

cin >> letter; while (letter != 'Q') { cout > tempIn;

if (letter == 'F') cout

cin >> letter; } return 0; }

// *****************************************************

int ConvertedTemp(int tempIn, char letter) { if (letter == 'C') return (9 * tempIn / 5) + 32; else return 5 * (tempIn - 32) / 9; }

C++ // Program Convert converts a temperature from Fahrenheit to // Celsiusor a temperature from Celsius to Fahrenheit // depending on whether theuser enters an F or a C. #include using namespace std; int

Exercise 4: Program Convert is an old friend. This version uses an int function to convert temperatures from Fahrenheit to Celsius or from Celsius to Fahrenheit. Examine program Convert carefully. The next exercises ask you to modify it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!