This could be one way to do it by passing variables. You need to define the variable outside of the function in order to pass it too the function.Code:int main() { float choice; cout << "This will convert fahrenheit to celsius."; cout << "What do you want to start with, enter your number than print enter.\n"; cout << " 1. Fahrenheit\n"; cout << " 2. Celsius\n"; cin >> choice; if (choice == 1) { float fTemp; cout << "Input temperature in fahrenheit: "; cin >> fTemp; cout << toCelcius(fTemp); else { float cTemp; cout << "Input temperature in celcius: "; cin >> cTemp; cout << toFahrenheit(cTemp); } } float toCelcius(float fTemp) { return (fTemp-32)/1.8 } float toFahrenheit(float cTemp); { return (1.8*cTemp)+32; }




Reply With Quote