![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
c02p119b.cppGo to the documentation of this file.00001 00015 // Exercise 14 00016 00017 int f(int n); 00018 00019 int main() 00020 { 00021 cout << "The value of f(8) is " << f(8) << endl; 00022 return 0; 00023 } // end main 00024 00026 int f(int n) 00027 { 00028 cout << "Function entered with n = " << n << endl; 00029 switch (n) 00030 { case 0: case 1: case 2: 00031 return n + 1; 00032 default: 00033 return f(n-2) * f(n-4); 00034 } // end switch 00035 } // end f |