diff --git a/src/main/c/Stefan/slot_machine.c b/src/main/c/Stefan/slot_machine.c index 54ac3e9..a779776 100644 --- a/src/main/c/Stefan/slot_machine.c +++ b/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]); }