This assignment is worth 15 points.
Example Output
Recursive version Fib(1) = 1 calls 1 Fib(2) = 1 calls 1 Fib(3) = 2 calls 3 ... Non-recursive version Fib(1) = 1 loops 0 Fib(2) = 1 loops 0 Fib(3) = 2 loops 1 ...
#include <time.h> ... const int US_TO_SEC = 1000000; ... clock_t start, stop, time; ... start = clock(); Fib(50,count); stop = clock(); time = stop-start cout << "That took " << time << "microseconds or " << time/US_TO_SEC << " seconds." << endl;
Example Output
m\n | 0 1 2 3 4 -----+-------------------------- 0 | 1 2 3 4 5 1 | 2 3 4 5 6 2 | 3 5 7 9 11 3 | 5 13 29 61 125setw and setfill might be very helpful producing this table.
Example Output
Enter the file name => example.in "racecar" YES! "god saw I was dog" YES! "I did, did I?" no. "Able was I ere I saw Elba." no. "A man, A plan, A canal: Panama!" no. "Madam, I'm Adam." no. "Hello World!" no. "spam" no.