Temperature Conversion

Hi! So I am working on a Final Program for a C++ class (you can expect other topics related) and I am trying to figure out why this portion of the program isn't working. No matter what is entered (C or F) it follows the fahrenheit formula. Thank you in advance!

char temp;
int C_temp, fahr, F_temp, cels;

cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
cout << "~~~~~~~~~~~CONVERSION~UTILITY~~~~~~~~~~~" << endl;
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
cout << "~~ Convert between " << endl;
cout << "~~ Celsius and Fahrenheit " << endl;
cout << "~~ " << endl;
cout << "~~ Enter C for Celsius or " << endl;
cout << "~~ F for Fahrenheit: ";
cin >> temp;
if (temp == 'F' || 'f')
{
cout << "~~ Enter degree in Fahrenheit: ";
cin >> fahr;
C_temp = (fahr - 32) / 1.8;
cout << "~~ Fahrenheit: " << fahr << endl;
cout << "~~ Celsius: " << C_temp << endl;
}
else if (temp == 'C' || 'c')
{
cout << "~~ Enter degree in Celsius: ";
cin >> cels;
F_temp = (cels * 1.8) + 32;
cout << "~~ Fahrenheit: " << cels << endl;
cout << "~~ Celsius: " << F_temp << endl;
}
Change if (temp == 'F' || 'f') to if (temp == 'F' || temp == 'f')

Do the same for the Celcius.
Thank you so much, I hate that it was that simple! I don't know if you can answer this, but I need it to ask the user if they want to return to the main menu after this runs. How would I do that? The menu is if/ else if driven.
Topic archived. No new replies allowed.