You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
Fig01_02.cpp - A simple recursive routine with a test program
|
|
|
|
#include <iostream.h>
|
|
|
|
int f( int x )
|
|
{
|
|
/* 1*/ if( x == 0 )
|
|
/* 2*/ return 0;
|
|
else
|
|
/* 3*/ return 2 * f( x - 1 ) + x * x;
|
|
}
|
|
|
|
int main( )
|
|
{
|
|
cout << "f(5) = " << f( 5 ) << endl;
|
|
return 0;
|
|
}
|