I am writing a game code and I keep getting these erroes 359 E: Game.cpp redefinition of `void PlaceYourBet()' 155 E: Game.cpp `void PlaceYourBet()' previously defined here can anyone help me out with these errors I know it must be simple.

Recommended Answers

All 2 Replies

The error message is clear enough.
U are defining the function void PlaceYourBet() more than once.
Check your code.

Thank you that worked I knew it was something dumb. I am writing a Black Jack Program and I can't figure out who to make the split function work do you think you can help me with that as well? I will show you what I have so far.

void SplitHand (void)
{
      int i        = 0;
      bankaccount -= betamt;
      betamt      *= 2;
      playercards    = 2;
      pcardsSplit[1] = pcards[2];
      pcards[2]      = 1 + rand() % 13;
      pcardsSplit[2] = 1 + rand() % 13;
      AlphaTheCards ();
      CalcTotal     ();  
        cout << "Players first hand has " << playercards << " cards." << endl;
        cout << "Player has a ";    
        for(int i = 1; i <= playercards; ++i)
                {
                 cout << palphacards[i];
                if(i < playercards)
                  {
                  cout << " and a ";
                  }
                } 
        cout << endl;
        cout <<  "Player's first hand has "<< ptotal << endl;             

      bankaccount -= betamt;
      betamt      *= 2;
      playercards    = 2;
      pcardsSplit[1] = pcards[2];
      pcards[2]      = 1 + rand() % 13;
      pcardsSplit[2] = 1 + rand() % 13;
      AlphaTheCards ();
      CalcTotal     ();

        cout << "Players second hand has " << playercards << "    cards." << endl;
        cout << "Player has a ";

        for(int i = 1; i <= playercards; ++i)
                {
                cout << palphacards[i];
                if(i < playercards)
                  {
                  cout << " and a ";
                   }
                }                            

          cout << endl;
          cout <<  "Player's second hand has "<< ptotal << endl;

          CheckForAce();             
         cout << " Player's first hand has " << endl;       

               }

this is what I have so far and it works but I can seem to get figure out how to get into the while loop to make it hit the first hand and then if you win or bust go into the second hand I know all I have to do is copy what I did in the first hand and change it to Palaphcards2 but I don't no the code I also need to ask the question

cout << " Would you like to get a hit? (yes/No) << endl;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.