// hearts.cpp // // A program that simulates some aspects of the game "Hearts". // // Elizabeth Sklar // August 2007 // include C and C++ headers #include #include #include using namespace std; // define constants for suits const int DIAMONDS = 0; const int CLUBS = 1; const int HEARTS = 2; const int SPADES = 3; // define constants for face characters, such that: // 0 is '2', 1 is '3', ... , 8 is ten ('T'), 9 is jack ('J'), // 10 is queen ('Q'), 11 is king ('K'), 12 is ace ('A') // 0123456789012 const string FACES = "23456789TJQKA"; /** * dealHand() * this function emulates dealing "numcards" from a deck. * it stores the cards in the "cards" array. * it ensures that there are no duplicates in the "cards" array. */ void dealHand( int numcards, int cards[] ) { bool picked[52]; // flags indicating if a card value has been picked or not int newcard; // value of new card srand( time( NULL )); // initialize random number seed for ( int i=0; i<52; i++ ) { // initialize "picked" flags picked[i] = false; } for ( int i=0; i