I'm creating a blackjack 40 game for my class. The code should output "BLACKJACK!" only once at the start if the player hits 40. The player will win 20$ once they hit blackjack. How would i change this code to make it only for the first hand.
int main ( ) {
char again;
do {
Blackjack game;
game.play();
cout << "Do you want to play again?";
cin >> again;
} while ( again == 'y' );
}
Then this seems easy enough.
1 2 3 4 5 6 7 8 9 10 11
int main ( ) {
char again;
int playedHands = 0;
do {
playedHands++;
Blackjack game(playedHands);
game.play();
cout << "Do you want to play again?";
cin >> again;
} while ( again == 'y' );
}
But if you have a sprawling mass of spaghetti code, then maybe your first task is to clean up what you have before you start adding more features to it.