55 lines
956 B
C++
Executable file
55 lines
956 B
C++
Executable file
#include <iostream>
|
|
#include "pile.h"
|
|
|
|
t_pile :: t_pile(void)
|
|
{
|
|
m_imax = -1;
|
|
};
|
|
|
|
t_pile :: t_pile(int customImax, int customJeton[])
|
|
{
|
|
m_imax = -1;
|
|
if(customImax < -1)
|
|
{
|
|
std :: cout << std :: endl << "t_pile : Erreur, imax inferieur a -1" << std :: endl;
|
|
}
|
|
else
|
|
{
|
|
while(m_imax<customImax-1)
|
|
{
|
|
m_imax++;
|
|
m_jeton[m_imax]=customJeton[m_imax];
|
|
};
|
|
};
|
|
};
|
|
|
|
void t_pile :: empiler(int newJeton)
|
|
{
|
|
if (m_imax>=10)
|
|
{
|
|
std :: cout << std :: endl << "t_pile : Erreur, valeur de jeton max depassee" << std :: endl;
|
|
}
|
|
else
|
|
{
|
|
m_imax ++;
|
|
m_jeton[m_imax]=newJeton;
|
|
};
|
|
};
|
|
|
|
void t_pile :: depiler(void)
|
|
{
|
|
m_jeton[m_imax]=0;
|
|
m_imax--;
|
|
};
|
|
|
|
int t_pile :: sommet(void)
|
|
{
|
|
return m_imax;
|
|
};
|
|
|
|
int t_pile :: dernier_jeton(void)
|
|
{
|
|
return m_jeton[m_imax];
|
|
};
|
|
|
|
t_pile :: ~t_pile(void){};
|