C++ Function Definition Create an inline function to convert Fahrenheit to Celsius

Description

C++ Function Definition Create an inline function to convert Fahrenheit to Celsius

#include <iostream>
using namespace std;
inline double tempvert(double inTemp)  // an inline function
{
   return (5.0/9.0) * (inTemp - 32.0);
}
int main()/*w ww . j a  v  a 2  s  . c  o m*/
{
   const 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;
}



PreviousNext

Related