diff --git a/src/main/c/Stefan/slot_machine.c b/src/main/c/Stefan/slot_machine.c index f0ee169..ff07038 100644 --- a/src/main/c/Stefan/slot_machine.c +++ b/src/main/c/Stefan/slot_machine.c @@ -17,10 +17,17 @@ void slotMachine(){ int getBalance(){ int balance; printf("Guthaben einwerfen: "); - scanf_s("%d", &balance); + balance = userInput(); + printf("Dein Guthaben: %d", balance); return balance; } +int userInput(){ + int input; + scanf_s("%d", &input); + return input; +} + 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 3da8ff8..56cebac 100644 --- a/src/main/c/Stefan/slot_machine.h +++ b/src/main/c/Stefan/slot_machine.h @@ -4,6 +4,6 @@ void slotMachine(); void welcomeMessage(); int getBalance(); - +int userInput(); #endif // SLOT_MACHINE_H \ No newline at end of file