Browse Source

Gewinne werden jetzt angezeigt

remotes/origin/dev
fdai7472 11 months ago
parent
commit
607f656bed
  1. 11
      src/main/c/Stefan/slot_machine.c

11
src/main/c/Stefan/slot_machine.c

@ -88,8 +88,8 @@ void randomizeSymbols(char symbols[]){
int spin(char symbols[], int bet, int balance){
int winnings = getWinnings(symbols, bet);
showResult(symbols);
int winnings = getWinnings(symbols, bet);
return balance;
}
@ -113,15 +113,20 @@ int getWinnings(char symbols[], int bet){
case 'C': winnings = bet * 10; break;
case 'D': winnings = bet * 20; break;
}
}
}
if (winnings > 0) {
printf("\nDu hast %d gewonnen!\n", winnings - bet);
}
else {
printf("\nLeider verloren.\n");
}
return winnings;
}
void showResult(char symbols[]){
for (int i = 0; i < ROWS; i++){
printf(" %c | %c | %c\n", symbols[i * ROWS], symbols[i * ROWS + 1], symbols[i * ROWS + 2]);
}

Loading…
Cancel
Save