Browse Source

getBalance erweitert mit userInput

remotes/origin/dev
fdai7472 11 months ago
parent
commit
d388098172
  1. 9
      src/main/c/Stefan/slot_machine.c
  2. 2
      src/main/c/Stefan/slot_machine.h

9
src/main/c/Stefan/slot_machine.c

@ -17,10 +17,17 @@ void slotMachine(){
int getBalance(){ int getBalance(){
int balance; int balance;
printf("Guthaben einwerfen: "); printf("Guthaben einwerfen: ");
scanf_s("%d", &balance);
balance = userInput();
printf("Dein Guthaben: %d", balance);
return balance; return balance;
} }
int userInput(){
int input;
scanf_s("%d", &input);
return input;
}
void welcomeMessage(){ void welcomeMessage(){
printf("Herzlich Willkommen zur \n\n" printf("Herzlich Willkommen zur \n\n"
" _ _ _ _ \n" " _ _ _ _ \n"

2
src/main/c/Stefan/slot_machine.h

@ -4,6 +4,6 @@
void slotMachine(); void slotMachine();
void welcomeMessage(); void welcomeMessage();
int getBalance(); int getBalance();
int userInput();
#endif // SLOT_MACHINE_H #endif // SLOT_MACHINE_H
Loading…
Cancel
Save