Aide svp c++

zied9992000 Messages postés 9 Date d'inscription lundi 16 juillet 2007 Statut Membre Dernière intervention 7 mars 2009 - 11 janv. 2009 à 15:20
lui88 Messages postés 28 Date d'inscription lundi 12 janvier 2009 Statut Membre Dernière intervention 22 juin 2009 - 13 janv. 2009 à 14:04
bonjour les amis, il ya une faute au niveau de l'operateur << pour chaque classe , aide svp :(

#include
class basepile{
public:
int *p,taille;
basepile(int);
basepile(basepile&);
virtual void operator<(int);
virtual void operator>(int&);
virtual void affiche();
friend ostream& operator<<(ostream&,const basepile&);
~basepile();
};

class lifo:public basepile{
public:
int sommet;
lifo(int);
lifo(lifo&);
virtual void operator<(int);
virtual void operator>(int&);
virtual void affiche();
friend ostream &operator<<(ostream&,const lifo&);
};

class fifo:public basepile{
public:
int tete,que;
fifo(int);
fifo(fifo&);
virtual void operator<(int);
virtual void operator>(int&);
virtual void affiche();
friend  ostream &operator<<(ostream&,const fifo&);
};

basepile::basepile(int n=10)
{taille=n;
p=new int[taille];}

basepile::basepile(basepile& a)
{taille=a.taille;
p=new int[taille];
for(int i=0;i<taille;i++)
p[i]=a.p[i];
}

basepile::~basepile(){delete []p;}

void basepile::operator<(int x)
{*p=x;}
void basepile::operator>(int &x)
{x=*p;}

void basepile::affiche(){
for(int i=0;i<taille;i++)
cout<(int &x)
{sommet--;
x=p[sommet];
}
void lifo::affiche(){
for(int i=0;i<sommet;i++)
cout<<"\n"<(int &x)
{x=p[tete];
 tete++;
}
void fifo::affiche(){
for(int i=tete;i<que;i++)
cout<<"\n"i;
cout<<"\ndepiler i="<<i<<"\n";
cout<affiche();
}

2 réponses

uaip Messages postés 1466 Date d'inscription mardi 20 février 2007 Statut Membre Dernière intervention 7 février 2011
11 janv. 2009 à 18:06
Salut,
Je suis peut-être nunuche mais je n'ai jamais vu utiliser des & comme ça.

Cordialement, uaip.
0
lui88 Messages postés 28 Date d'inscription lundi 12 janvier 2009 Statut Membre Dernière intervention 22 juin 2009
13 janv. 2009 à 14:04
salut , oui je suis d'accord avec uaip je n'ai jamais vu utilisé les & comme sa
0
Rejoignez-nous