Browse Source

Eingabe Wetteinsatz added

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

15
src/main/c/Stefan/slot_machine.c

@ -7,7 +7,12 @@ void slotMachine(){
int balance = getBalance(); int balance = getBalance();
while(balance > 0){
int bet = getBet(balance);
balance -= bet;
printf("%d\n", balance);
}
@ -18,7 +23,7 @@ int getBalance(){
int balance; int balance;
printf("Guthaben einwerfen: "); printf("Guthaben einwerfen: ");
balance = userInput(); balance = userInput();
printf("Dein Guthaben: %d", balance);
printf("Dein Guthaben: %d\n", balance);
return balance; return balance;
} }
@ -28,6 +33,14 @@ int userInput(){
return input; return input;
} }
int getBet(int balance){
int bet;
printf("Wetteinsatz: ");
bet = userInput();
return bet;
}
void welcomeMessage(){ void welcomeMessage(){
printf("Herzlich Willkommen zur \n\n" printf("Herzlich Willkommen zur \n\n"
" _ _ _ _ \n" " _ _ _ _ \n"

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

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