Code:
// This is a blackjack game in c++
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
// come back and put classes in there own header files
class Deck {
public:
vector<string> cards;
void shuffle();
void set_up_deck();
private:
string plainCards[52];
};
void Deck::shuffle() {
random_shuffle(cards.begin(), cards.end());
}
void Deck::set_up_deck() {
string plainCards[52] = {"Ace","2","3","4","5","6","7","8","9","10","J","Q","K","Ace","2","3","4","5","6","7","8","9","10","J","Q","K","Ace","2","3","4","5","6","7","8","9","10","J","Q","K","Ace","2","3","4","5","6","7","8","9","10","J","Q","K"};
vector<string> cards (52);
for (int i=0; i<52; i++) {
cards[i] = plainCards[i];
}
}
int main() {
cout << "Blackjack test" << endl;
Deck deck1;
deck1.set_up_deck();
cout << "Here are the unshuffled cards" << endl;
for (int j=0; j<10; j++) {
cout << deck1.cards[j] << ",";
}
deck1.shuffle();
cout << "Here are the shuffled cards" << endl;
for (int j=0; j<10; j++) {
cout << deck1.cards[j] << ",";
}
return 0;
}