/* Receive winnings of a bet - covers blackjack and 'normal' wins*/ void Box::ReceiveWinnings() { /* A blackjack win */ if(CheckHand() == 21 and Hand.size() == 2 and SplitBox == false) { Owner->AddToStack(Bet + Bet + (Bet/2)); } /* A non-blackjack win */ else { Owner->AddToStack(Bet + Bet); } }
/* Receive winnings of a bet - covers blackjack and 'normal' wins*/ void Box::ReceiveWinnings() { /* A blackjack win */ if(CheckHand() == 21 and Hand.size() == 2 and SplitBox == false) { Owner->AddToStack(Bet + Bet + (Bet/2)); cout << " Wins bet and collects " << (Bet + (Bet/2)) << " from the dealer" << endl; } /* A non-blackjack win */ else { Owner->AddToStack(Bet + Bet); cout << " Wins bet and collects " << Bet << " from the dealer" << endl; } }
int main(void) { fillDeck(); shuffleDeck(); passCard(playerHand, Player); passCard(playerHand, Player); PrintHand(); printf("You score is (%i). ", scorePlayerHand); do { CheckHand(); Ask(); Choice(); PrintHand(); printf("You score is (%i). ", scorePlayerHand); } while ((userAnswer == 'y' || userAnswer == 'Y')); getWinner(); return 0; }
/* Receive the card dealt to the box */ void Participant::TakeCard(const Card& DealtCard) { Hand.push_back(DealtCard); HandValue += DealtCard.GetValue(); /* Keep a count of the number of aces held */ string CompareString = DealtCard.GetName(); if (CompareString.compare("Ace") == 0) { AcesHeld++; } /* Soften any aces if required */ if(CheckHand() > 21) { if (AcesHeld > 0) { SoftenAce(); } } }