Пример #1
0
int main(){
	setSeed(); //set random number seed
	beginGame(); //set chips=1000, print intro 
	shuffle();
	while (playing) {
		setup(); //shuffle deck, reset starting values
		makeBet(); //give initial bet amount
		dealBlackJack(); //deal player and dealer hands
		if (playerBlackjack()){ //check for player blackjack
			win();
			input=0;
		}
		else
			play(); //player plays Hand

		if (input!=0){ //if player didnt bust or blackjack
			playDealer();
			endRound();
		}

		if (playing) { 	//continue to next round
			pad(15); printf("Next Round...\n\n");
		}
	}
}
Пример #2
0
int main()
{
    float betAmount, money;
    int value, random, action;
        // do while loop so user can keep playing
do {
    showInstructions();
    betAmount = getBetAmount();
    value = makeBet();
    random = spinWheel();
    money = figureWinnings(value, random, betAmount);
    printf("\nYou won $%.2f", money);
    printf("\nDo you want to play another game?\nPress o to quit or 1 to continue. ");
    scanf("%d",&action);
}while (action != 0);

    return 0;
}
Пример #3
0
//play Craps game, calling all appropriate functions
//Parameter: none
//Return Type: none
void playCraps(void)
{
	int wallet;
	int bet;

	wallet = getWallet();
	do
	{
		bet = makeBet(wallet);
		if (playRound())		//this just means if it's true
		{
			printf("You win!\n");
			wallet += bet;
		}
		else                   //if playRound is false
		{
			printf("You lose!\n");
			wallet -= bet;
		}
	} while (wallet >= MIN_BET&&doAgain());

	goodbye(wallet);
}