Writing a Blackjack Code for Class

Hi,
I am writing a Blackjack program for my C++ class. The game must contain the ability to bet before the cards are given out, the cards must be randomized before being dealt, the game must ask the player wants to play again and loop if the player does.
https://gist.github.com/4274058
I have this much so far but i now need to make it randomize the cards it deals, and I cannot figure it out for the life of me.
I haven't checked out your code on the external link ,but let's say your deck is an array of cards:
std::vector<Card> Deck;

Then you can shuffle it like so:
1
2
3
4
5
#include <algorithm>
//...
std::vector<Card> Deck;
//...
std::random_shuffle(Deck.begin(), Deck.end());


Just make sure that you define bool Card::operator<(Card lhs);
Topic archived. No new replies allowed.