/* G. Hagopian
11. Write a program that writes out the first so many values of the Fibonacci 
series, that is, the series that starts with 1 1 2 3 5 8 13 21 34. The 
next number of the series is the sum of the two previous ones. Find the 
largest Fibonacci number that fits in an int.
*/
#include "std_lib_facilities.h"

inline int fib(int a, int b) {
	if (b > 1100000000) {
		cout << "Too big\n";
		return 0;
	}
	return a + b;
}

int main() {
	int N;
	vector<int> fibonaccis{ 1,1 };
	do {
		fibonaccis.erase(fibonaccis.begin() + 2, fibonaccis.end());
		cout << "Enter the number of Fibonacci number you want: ";
		cin >> N;
		for (int i = 2; i < N; ++i)
			fibonaccis.push_back(fib(fibonaccis[i - 1], fibonaccis[i - 2]));
		cout << "Here they are: \n";
		for (int x : fibonaccis) cout << x << " ";
		cout << "\n";
	} while (1);
	
}