Results 1 to 4 of 4
  1. #1
    Gab's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    6,716
    Reputation
    1755
    Thanks
    1,543

    Help with an error

    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)//)

  2. #2
    Auxilium's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    深い碧の果てに
    Posts
    4,518
    Reputation
    445
    Thanks
    609
    My Mood
    Happy
    [php]while((i==1) || (i==2))[/php]

    = is assigning
    == is comparing
    Last edited by Auxilium; 09-20-2010 at 05:25 PM.

  3. The Following 2 Users Say Thank You to Auxilium For This Useful Post:

    Gab (09-20-2010),Void (09-20-2010)

  4. #3
    Gab's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    6,716
    Reputation
    1755
    Thanks
    1,543
    Ho yeah lol thank u (Yes i know I know it, I just forgot it ) But thank you!

  5. #4
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by Koreans View Post
    [php]while((i==1) || (i==2))[/php]

    = is assigning
    == is comparing
    That's exactly right. |:

    Gewd job Pat.

  6. The Following User Says Thank You to Void For This Useful Post:

    therofl (10-01-2010)

Similar Threads

  1. Need Help With Themida Error?
    By DreamStreet in forum Combat Arms Hacks & Cheats
    Replies: 26
    Last Post: 07-15-2009, 10:53 AM
  2. Need help with this error...
    By Screenlooker in forum Combat Arms Hacks & Cheats
    Replies: 6
    Last Post: 12-27-2008, 02:21 PM
  3. Help with this error
    By Nick0715 in forum Combat Arms Hacks & Cheats
    Replies: 2
    Last Post: 11-16-2008, 08:57 PM
  4. Help With This Error
    By GoBxHiTz in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 6
    Last Post: 09-17-2008, 06:18 PM
  5. Help With this error
    By GoBxHiTz in forum Combat Arms Hacks & Cheats
    Replies: 6
    Last Post: 08-19-2008, 01:20 AM