This is a very early draft for this program code. Taken mostly from Joseph Tomlin's instructional videos on YouTube. For class lecture. In card.h class card { public: card(); card(string, string); string print () ; private: string face: string suit; }; string card::print() { return (face + “ of “ + suit); } in deckofCards.h - we #include card.h const int CARDS_N_DECK = 52; class deckofCards { public: deckofcards(); void shuffle(); card dealCard(); void printDeck() ; private: card*deck; int currentCard; .. void deckofcards::printDeck() { for (int i=0; i<CARDS_N_DECK; i++){ cout << deck[i].print(); } deckofcards::deckofCards(){ string face[]={“Ace”, “Deuce”, “Three”, ..., “Ten”, “Jack”, “Queen”, “King”); string suit[] = {“Hearts”, “Diamonds”, “Clubs”, “Spades”}; deck = new card[CARDS_N_DECK]; currentCard = 0; for int count=0; count < CARDS_N_DECK; count++){ //populate the deck deck[count]=card(face[count%13], suit[count/13);} //Cute. How else can we do this? main(){ deckofCards deck; card currentCard; deck.printDeck(); deck.shuffle(); deck.printDeck(); ... } |