#include #include #include //MinGW does not compile without this included when time is involved. class DeckOfCards { private: int index=0, deck[53]; //deck is size 53 as a hack designed to prevent segfaults. public: DeckOfCards(); void shuffle(); int dealCard(); }; void showHand(int hand[], const int size); int main() { srand(time(NULL)); const int size=4; //Size can be changed for larger hands DeckOfCards deck; int hand[size]; for (int i=0; i<26; i++) { for (int j=0; j1; i--) { j = rand() % 50 + 1; if (j < i) { temp=deck[i]; deck[i]=deck[j]; deck[j]=temp; } } } //Function to deal the card when asked by grabbing from the deck and shuffling if such card does not exist. int DeckOfCards::dealCard() { index++; if (index>=52) { index=0; shuffle(); } return deck[index]; }