Preview:
void DealersTurn(cards PlayerHand[], cards DealerHand[])//dealers turn function
{
	DealerTotalHandscore = 0;//sets ai hand score to 0 to reset it when they start thier turn

	for (i = 0; i < dealerCurrentHand; i++)//when dealer gets a card it adds to the value
	{
		DealerTotalHandscore += DealerHand[i].PlayerValue;
	}

	if (DealerTotalHandscore < 17)//if dealer is less than 17 they can draw a card
	{
		HitDealer(PlayerHand, DealerHand);//draws card for dealer
		Sleep(2000);//delay for immersion
		DealersTurn(PlayerHand, DealerHand);//dealers turn again since its below 17
	}

	if (DealerTotalHandscore >= 17)//if dealers hand is above 17
	{
		if (TotalHandscore > DealerTotalHandscore)//checks if players hand is bigger than the dealers hand, if player went over the game wouldve already end
		{
			Sleep(2000);//delay for suspense
			std::cout << "You win! Congrats! Your hand total is " << TotalHandscore << " The dealers was " << DealerTotalHandscore << std::endl;
			Sleep(2000);
			bank += currentbet * 2;
			std::cout << "You now have $" << bank << " in your bank" << std::endl;
			Sleep(2000);
			std::cout << "Do you want to continue playing? " << std::endl << "1.Yes " << std::endl << "2.No" << std::endl;
			Choice = 0;
			std::cin >> Choice;//player chooses to play or exit

			if (Choice == 1)
			{
				Choice = 0;
				reset();
			}

			if (Choice == 2)
			{
				Choice = 0;
				Quitgame();
			}
		}
	}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter