C++ examples for Function:Function Creation
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 w w . java 2s . c o m { 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; }