diff --git a/src/main/c/Stefan/slot_machine.c b/src/main/c/Stefan/slot_machine.c index ff07038..dfddd13 100644 --- a/src/main/c/Stefan/slot_machine.c +++ b/src/main/c/Stefan/slot_machine.c @@ -7,7 +7,12 @@ void slotMachine(){ int balance = getBalance(); + while(balance > 0){ + int bet = getBet(balance); + balance -= bet; + printf("%d\n", balance); + } @@ -18,7 +23,7 @@ int getBalance(){ int balance; printf("Guthaben einwerfen: "); balance = userInput(); - printf("Dein Guthaben: %d", balance); + printf("Dein Guthaben: %d\n", balance); return balance; } @@ -28,6 +33,14 @@ int userInput(){ return input; } +int getBet(int balance){ + int bet; + printf("Wetteinsatz: "); + bet = userInput(); + + return bet; +} + void welcomeMessage(){ printf("Herzlich Willkommen zur \n\n" " _ _ _ _ \n" diff --git a/src/main/c/Stefan/slot_machine.h b/src/main/c/Stefan/slot_machine.h index 56cebac..14a3217 100644 --- a/src/main/c/Stefan/slot_machine.h +++ b/src/main/c/Stefan/slot_machine.h @@ -5,5 +5,6 @@ void slotMachine(); void welcomeMessage(); int getBalance(); int userInput(); +int getBet(int balance); #endif // SLOT_MACHINE_H \ No newline at end of file