Lab 3
Lab 3
Lab 3
Use an array to hold your cards. There are four suits in a deck and 13 cards
for a suit (A, 210, J, Q, and K). Using a / operator with a switch
statement can pin point the suit of the selected card.
To print a suit after detecting it, char(3), char(4), char(5) and char(6) will print
heart, diamond, club, and spade respectively.
The function Another_Card will ask if you want to receive a card for the
current player. If yes, then call the appropriate function and display the
selected card. Otherwise, move on to the next player.
An additional 10% will be awarded for a program that will allow a user to
play another game without restarting it. Hint a call to a system function cls
will clear the screen for you.
A function to finish the dealer after all players are done. This function will
display the first card to the dealer and will automatically finish the dealer
according to the rules.
A function to calculate users status after the dealer is done. Win Lose, or Tie.
cards[i] = number;
duplicate[number] = 1;
}
for(i = 0; i < 8; i++)
{
suit = char(cards[i]/13+3);
cardValueSwitch = cards[i]%13;
if(cardValueSwitch < 10)
cardValue = cardValueSwitch + 1;
else
cardValue = 10;
cardFace = ' ';
if(cardValueSwitch == 0)
cardFace = 'A';
else if(cardValueSwitch == 10)
cardFace = 'J';
else if(cardValueSwitch == 11)
cardFace = 'Q';
else if(cardValueSwitch == 12)
cardFace = 'K';
//cout << setw(2) << cards[i] << setw(2) << suit << setw(3) << cardValue;
//column,row
gotoxy(i*7, 3);
if(cardFace == ' ')
cout << setw(3) << cardValue;
else
cout << setw(3) << cardFace;
cout << suit;
cout << endl;
}
cout << endl;
system("pause");
return 0;
}