Beispiel #1
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;
}
Beispiel #2
0
// Input:   player struct array, the current player's number.
//
// Output:  none
void playRoul(struct player player[], int playerNumber){

    // Create array to hold up to 10 bets
    struct rBet bets[MAXBETS];
    // Initialize all values to -1 (-1 will never be the result of a spin)
    int i, j;
    for(i = 0; i < MAXBETS; i++){
        for(j = 0; j < MAXNUMWIN; j++){
            bets[i].win_nums[j] = -1;
        }
    }

    printBoard();

    // Get the bets and generate random spin
    int num_bets = rGetBet(bets, player, playerNumber);
    int spinNum = spinWheel();

    processSpin(bets, spinNum, num_bets, player, playerNumber);
}