// Chap 2, p 75 #include int Rabbit(int N) // --------------------------------------------------- // Computes a term in the Fibonacci sequence. // Precondition: N is a positive integer. // Postcondition: Returns the Nth Fibonacci number. // --------------------------------------------------- { if (N <= 2) return 1; else // N > 2, so N-1 > 0 and N-2 > 0 return Rabbit(N-1) + Rabbit(N-2); } // end Rabbit // ******SAMPLE MAIN PROGRAM****** main() { cout << "Recursive Rabbit: " << endl; cout << Rabbit(1) << " " << Rabbit(2) << " "; cout << Rabbit(3) << " " << Rabbit(4) << " "; cout << "\n"; return 0; }