I'm creating a program that converts Fahrenheit to Celsius using multiple functions. This is a project for class so I do have to use the functions. I have it all set but for whatever the reason the output is #INF .
I'm not sure where I went wrong so some help would be great.
#include <iostream>
#include <string>
#include <iomanip>
usingnamespace std;
int main()
{
/* declarations ***********************************************
declare function prototypes & data
*/
// declare local function prototype
double enterTemperature(); // input function prototype
double convertTemperature(double); // processing function prototype
void printCelsius(double); // output function prototype
// declare local constants (scope: local)
constint CONVERTS = 4; // number of conversions to be made
// declare local variables (scope: local)
double fahrenheit;
double celsius;
/* statements *************************************************
code function instructions
*/
for(int index = 0; index < CONVERTS; index++)
{
// call function to obtain utemperature from user
fahrenheit = enterTemperature();
// call function to convert temperature (f to c)
celsius = convertTemperature(fahrenheit);
// call function for format & display converted temperature
printCelsius(celsius);
}
cin.get();
return 0;
} // end of main() function ----------------------------------------
//-------------------------------------------------------------------
// Input Function
//-------------------------------------------------------------------
double enterTemperature()
{
int temperature;
cout << "Enter the tempeture in fahrenheit : ";
cin >> temperature;
return temperature;
}
//-------------------------------------------------------------------
// Processing Function
//-------------------------------------------------------------------
double convertTemperature(double fahrenheit)
{
double celsius;
celsius = ((fahrenheit - 32) / (5/9));
return celsius;
}
//-------------------------------------------------------------------
// Output Function
//-------------------------------------------------------------------
void printCelsius(double celsius)
{
cout << celsius << endl;
}