/* * CS307 Assignment 1 * Card Game * Dan J. Fraser * */ /* * Implementation for Card class */ #include "Card.h" #include // Constructor for the card, requires a rank and a suit to initalize variables Card::Card(int init_rank, char init_suit) { rank = init_rank; suit = init_suit; } // Returns the rank of the card. int Card::get_rank(void) { return rank; } // Returns the suit of the card. char Card::get_suit(void) { return suit; } // writes (in plain english) the contents of the card // using cout, followed by a newline. void Card::show(void) { switch(rank) { case 11: cout << "Jack"; break; case 12: cout << "Queen"; break; case 13: cout << "King"; break; case 1: cout << "Ace"; break; default: cout << rank; break; } cout << " of "; switch(suit) { case 'H': cout << "Hearts"; break; case 'D': cout << "Diamonds"; break; case 'S': cout << "Spades"; break; case 'C': cout << "Clubs"; break; default: cout << "uknown"; break; } cout <<"\n"; }