-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (26 loc) · 910 Bytes
/
main.cpp
File metadata and controls
32 lines (26 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include "fibonacci.h"
#define FIBONACCI_SEQUENCE_LIMIT 100
//
// Program to display first 50 numbers is the Fibonacci sequence
// using an iterative approach followed by a recursive approach
//
int main()
{
int sequenceIterator;
Fibonacci obj;
VeryLong arg1;
VeryLong arg2;
std::cout << "\nUsing iterative method to disply the first " \
<< FIBONACCI_SEQUENCE_LIMIT \
<< " numbers of the Fibonacci Sequence\n\n";
for(sequenceIterator = 0; sequenceIterator < FIBONACCI_SEQUENCE_LIMIT; sequenceIterator++)
{
std::cout << obj.iterativeNextInSequence() << '\n';
}
std::cout << "\nUsing recursive method to disply the first "\
<< FIBONACCI_SEQUENCE_LIMIT \
<< " numbers of the Fibonacci Sequence\n\n";
obj.recursivePrintSequence(arg1, arg2, FIBONACCI_SEQUENCE_LIMIT);
return 0;
}