C++ Function Parameter convert Fahrenheit to Celsius

Description

C++ Function Parameter convert Fahrenheit to Celsius

#include <iostream>
using namespace std;
double tempvert(double);   // function prototype
int main()//from w  ww .  j a v  a2  s.  com
{
   const int CONVERTS = 4; // number of conversions to be made
   int count;
   double fahren;
   for (count = 1; count <= CONVERTS; count++)
   {
      cout << "\nEnter a Fahrenheit temperature: ";
      cin  >> fahren;
      cout << "The Celsius equivalent is "
      << tempvert(fahren) << endl;
   }
   return 0;
}
// convert Fahrenheit to Celsius
double tempvert(double inTemp)
{
   return (5.0/9.0) * (inTemp - 32.0);
}



PreviousNext

Related