Demonstrate inline functions - C++ Function

C++ examples for Function:Function Creation

Description

Demonstrate inline functions

Demo Code

#include <iostream>
using namespace std;
// converts pounds to kilograms
inline float lbstokg(float pounds)
{
   return 0.453592 * pounds;
}
int main()/*from  w  w w . jav  a2  s. co  m*/
{
   float lbs;
   cout << "\nEnter your weight in pounds: ";
   cin >> lbs;
   cout << "Your weight in kilograms is " << lbstokg(lbs) << endl;
   return 0;
}

Result


Related Tutorials