Browse Source

Implementierung getBet und userInput BJ

remotes/origin/stefan
fdai7472 12 months ago
parent
commit
c9604b7635
  1. 25
      src/main/c/Stefan/blackjack.c
  2. 2
      src/main/c/Stefan/blackjack.h

25
src/main/c/Stefan/blackjack.c

@ -8,6 +8,8 @@ int blackjack(){
printf("Welcome to Blackjack \n");
int balance = getBalanceBJ();
int bet = getBetBJ(balance);
printf("bet: %d\n", bet);
return 0;
}
@ -16,6 +18,27 @@ int getBalanceBJ(){
int balance = 0;
printf("Guthaben einwerfen: ");
scanf("%d", &balance);
printf("Dein Guthaben: %d", balance);
printf("Dein Guthaben: %d\n", balance);
return balance;
}
int getBetBJ(int balance){
while(1){
printf("Wetteinsatz: ");
int bet = userInputBJ();
if(bet <= balance && bet > 0){
return bet;
} else {
printf("Ungueltige Eingabe!\n");
}
}
}
int userInputBJ(){
int input;
scanf("%d", &input);
return input;
}

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

@ -4,5 +4,7 @@
int blackjack();
int getBalanceBJ();
int getBetBJ(int balance);
int userInputBJ();
#endif // BLACKJACK_H
Loading…
Cancel
Save