/// GH doing PPP chapter 8 exercise 3

#include "..\std_lib_facilities.h"

void print(vector<int> v, string s) {
    cout << endl << s << " = ";
    for(int i = 0; i < v.size(); ++i)
        cout << v[i] << " ";
}

void fibonacci(int x, int y, vector<int>& f, int n) {
    f.push_back(x);
    f.push_back(y);
    for(int i = 2; i< n; ++i)
        f.push_back(f[i-1]+f[i-2]);
}

int main() {
    int x,y;
    vector<int> v;
    cout << "\nEnter the first two elements of your Fibonacci-like sequence: ";
    while(cin >> x >> y) {
        fibonacci(x,y,v,100);
        print(v, "fibonacci");
        cout << "\nEnter the first two elements of your Fibonacci-like sequence: ";
        v.clear();
    }
}
