
Untitled
By: a guest on
May 27th, 2012 | syntax:
C++ | size: 1.01 KB | hits: 30 | expires: Never
// constructor
Deck::Deck()
{
string suit;
int index = 0;
for (int j = 0 ; j < 4; j++)
{
// Determine the suit to which the card belongs
switch (j)
{
case 0:
suit = "hearts";
break;
case 1:
suit = "diamonds";
break;
case 2:
suit = "spades";
break;
case 3:
suit = "clubs";
break;
default:
suit = "unknown";
break;
}
//Create the card, initialize its values and add it to the deck of cards
for (int i = 0 ; i < 13; i++)
{
Card new_card;
cards.push_back(new_card);
cards[index].suit = suit;
cards[index++].value = i;
}
}
}
// destructor that I've been messing with
Deck::~Deck()
{}
// driver
int main ()
{
Deck deck;
return 0;
}