C++ examples for Function:Function Creation
Using an inline function to calculate the volume
#include <iostream> inline double cube(const double side) { return side * side * side; } int main(int argc, const char *argv[]) { double sideValue; std::cout << "Enter the side length of your cube: "; std::cin >> sideValue;/*from w w w . j a va 2s. c om*/ // calculate cube of sideValue and display result std::cout << "Volumen of cube with side " << sideValue << " is " << cube(sideValue) << std::endl; return 0; }