1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
//initialize suit array
static const char *suit[4] = {
"Hearts",
"Diamonds",
"Clubs",
"Spades"
};
//initialize face array
static const char *face[13] = {
"Ace",
"Deuce",
"Three",
"Four",
"Five",
"Six",
"Seven",
"Eight",
"Nine",
"Ten",
"Jack",
"Queen",
"King"
};
//MODIFICATION-->only need 10 cards dealt
int g = 0;
for (int card = 1; card <= 10; card ++)
{
//loop through rows of deck
for (int row = 0; row <= 3; row ++)
{
//loop through columns of deck for current row
for (int column = 0; column <= 12; column ++)
{
//if slot contains current card, display card
if (deck[row][column] == card)
{
cout << setw(5) << right << face[column] << " " << column << "" << " of ";
cout << setw(8) << left << suit[row];
/*hands[g] = column;*/
/*g++;*/
if (card % 2 == 0)
{
cout << endl;
//store the column number (face value) in player1 array
player1[g] = column;
//increment the counter
g++;
}
else
{
cout << "\t";
//store the column number (face value) in player2 array
player2[g] = column;
g++;
}
}
}
}
}
|