Changing card

hey guys i just got task from my lecturer. he ask me to make a poker game. the rule of the game is that there are 3 players. each player has an opportunity to change one of their cards once. he want me to use random number, so which player or how many player who wanna change the card will determined automatically.

i made a program like this yesterday, but only one player could change their card. anybody can help me? thanks in advance^^

1
2
3
4
5
6
7
8
9
    int j;
    for(k=17; k<20; k++)
    {
        j = ((rand() % 3 )+ 17);
    }
    a[j] = a[21];
    int temp = a[k];
    a[k]=a[j];
    a[j]=temp;
Last edited on
closed account (o3hC5Di1)
Hi there,

This can't be your full program, can you please post the entire (relevant) code so we can see this snippet in its wider context?

Thanks,
NwN
edited^^
Last edited on
You're going to have a very tough time getting someone to help you with this since every variable is only one letter long. We have no idea what each variable is/does.

Also, the code you showed us to begin with and the very code that I helped you with, doesn't do what I think you wanted it to do, it picks three random values (17, 18, 19) but only assigns the last random value...I don't know if that makes much sense.

If that is supposed to be your draw card function, it's wrong.
Topic archived. No new replies allowed.