I made a small blackjack game as one of the programs I am going to demonstrate to my teacher at the end of the year.
I am simply using a string with all the 52 cards, like this:
Then I am using rand() to pull out one random char from that string every time either you or the dealer picks a card.Code:// 0 represents 10 string cardstock = "234567890JQKA234567890JQKA234567890JQKA234567890JQKA";
This is working out alright, and the game works, however there is one slight problem.
The game pulls out the same cards every time you start the program.
In my case, your first hand will always be "J + 6".
The problem obviously lies in rand().
So how to I fix this so you don't always start with the same cards?
It doesn't have to to be a "true random" generator.
As long as you don't always start with the same hand I'm happy with it.
Thanks in advance.