So what I am attempting to do is randomly populate a string array with a deck of cards. I am attempting to do this by "randomly" creating a number between 0-51 so that my array at that location will equal that enum suit followed by the enum value. So looking at my code you can see that the way I am setting the value in my array will cause an error. How do I go about accomplishing this while keeping the enumeration?
class DeckOfCards{
private:
string deck[52];
int sCount = 0;
int vCount = 0;
enum Suits{hearts, diamonds, clubs, spades};
enum Value{two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace};
public:
DeckOfCards(){
deck[52];
}
void shuffle(DeckOfCards noShuff){
srand(time(nullptr));
for(int i = 0; i < 52; i++){
deck[rand() % 52] = Suits[sCount] + Value[vCount];
sCount++;
vCount++;
}
}
};