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_03.cpp - An example of infinite recursion
|
|
|
|
#include <iostream.h>
|
|
|
|
int bad( int n )
|
|
{
|
|
/* 1*/ if( n == 0 )
|
|
/* 2*/ return 0;
|
|
else
|
|
/* 3*/ return bad( n / 3 + 1 ) + n - 1;
|
|
}
|
|
|
|
int main( )
|
|
{
|
|
cout << "bad is infinite recursion" << endl;
|
|
return 0;
|
|
}
|