//--------------------------------------------------------------- // // r1.cpp // // An example of a recursive function: raising a number to a power // // Written by: Simon Parsons // Date: 28th November 2007 // #include using namespace std; int power( int x, int y ) { if ( y == 0 ) return( 1 ); else return( x * power( x, y-1 )); } // end of power() int main() { cout << "2^3 = " << power( 2,3 ) << endl; }