I would like to know what it could be i don't understand the error...
Code:
void Personnage::Jouer(Personnage &david, Personnage &goliath)
{
int i;
while (i = 1 || i = 2)
{
cout << endl << "Que voulez-vous faire?" << endl;
cout << endl << "1. Donner de la vie a David" << endl;
cout << endl << "2. Attaquer Goliath" << endl;
if (i = 1)
{
david.boirePotionDeVie(20);
}
else if (i = 2)
{
david.attaquer(goliath);
}
else
{
cout << endl << "Mauvaise touche!" << endl;
}
cout << endl << "Voici maintenant les nouvelles statistiques..." << endl;
cout << "David" << endl;
david.afficherEtat();
cout << endl << "Goliath" << endl;
goliath.afficherEtat();
if (david.m_vie <= 0)
{
david.m_vie = 0;
cout << endl << "David est mort..." << endl;
i = 5;
}
else if (goliath.m_vie <= 0)
{
goliath.m_vie = 0;
cout << endl << "Bravo! David a gagner!" << endl;
i = 5;
}
else
{
cout << " " << endl;
}
}
}
Error : Personnage.cpp|86|error: lvalue required as left operand of assignment|
(it refer that line : //while (i = 1 || i = 2)//)