Dealing Poker Hands for a beginner

This is a discussion on Dealing Poker Hands for a beginner within the C++ Programming forums, part of the General Programming Boards category; Yes this is for homework, however I dont just want the answer nor am I asking for it, I have ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    Dealing Poker Hands for a beginner

    Yes this is for homework, however I dont just want the answer nor am I asking for it, I have seen a ton a posts with code and everythingwith very similar questions. I have the basic code down from the example we were given to work off of, however I am trying to figure out how to adjust it so it deals 5 cards to two players. I can deal 5 random cards but whenever I get two players, it uses the same cards. Im not sure if Im suppose to loop it, use an array, basically I am 2 weeks into this class and really want/need to learn this but am lost so I finally broke down and I am reaching out to you guys for some advice to point me in the right direction for me to look. Thanks

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    100
    For future reference, you might want to post your code for questions like this. That being said I think I can probably guess what your problem is.

    If the same five randomly-selected cards keep going to both players every single time, that's probably because you're only randomly selecting five cards, and you're only doing that one time. You're probably selecting all of your cards first, five in total, then dealing them out further down in your code without ever messing with the selection again. Really you need to randomly select 10 cards, five for each player. And since it's poker, you may wish to select a card, remove it from the deck, hand it to the appropriate player, then move to the next card.

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161
    srand() is probably being called within your loop. It should only be called once.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Designing a program to deal out seven card stud poker hands
    By killsthehorse in forum C++ Programming
    Replies: 29
    Last Post: 12-08-2008, 03:03 PM
  2. Are you a programmer with too much time on your hands?
    By Drakir in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 04-03-2007, 02:22 PM
  3. poker hands
    By noodle24 in forum C++ Programming
    Replies: 3
    Last Post: 05-19-2006, 01:53 PM
  4. Gamecube Controllers >> Sweaty Hands
    By LordVirusXXP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 12-27-2002, 05:14 AM
  5. Replies: 9
    Last Post: 11-27-2001, 08:25 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21