#include <iostream>
#include "../lib/saisieMR.hpp"

using namespace std;

template <class T, int qty>
class tabFun
{
	T _tab[qty];
	int _index;
public:
	tabFun()
	{
		_index = 0;
	}
	bool end()
	{
		return _index >= qty;
	}
	void next()
	{
		if (!end())
			_index++;
	}
	void reset()
	{
		_index = 0;
	}
	T get()
	{
		if (end())
			return -1;
		return _tab[_index];
	}
	void put(T data)
	{
		if (!end())
			_tab[_index]=data;
	}
	operator T ()
	{
		if (!end())
			return _tab[_index];
		return 0;
	}


};

int main()
{
	saisie <void> pause("appuyer sur une fucking touche pour continuer\n");

	tabFun <int , 10> tableau;

	int i = 0;

	while (!tableau.end())
	{
		tableau.put(i);
		i++;
		cout << tableau.get() << endl;
		tableau.next();
	}
	tableau.reset();

	pause();
	return 0;
}

