I need some help with a program function

I'm working on a program that converts fahrenheit to celsius temperatures. I have the program written but I need to write a function to go with the program. This is what I have right now:

#include <iostream>
#include <string>

using namespace std;

int main()
{
//Declaration Block
float tempFahrenheit = 0;
float tempCelsius = 0;

//User Input Block
cout << "Please enter the temprature in Fahrenheit to Convert: " << endl;
cin >> tempFahrenheit;

tempCelsius = (float)(5.0 / 9.0) * (float)(tempFahrenheit - 32);

cout << "Your temperature in celsius is: " << tempCelsius << endl;

system("pause");

return 0;
}
Last edited on


please use code tags


1
2
3
4
float converter( float fahrenheit )
{
           return ((5.0 / 9.0) * (fahrenheit - 32)) ;
}
;
Last edited on
Now where do I plug that into the program in order for it to compile correctly?
Topic archived. No new replies allowed.