Browse Source

functional 18: checkAnswer (useranswer nicht <> 1-4)

remotes/origin/Christian
Christian Reum 11 months ago
parent
commit
e7a9876c98
  1. 7
      src/wwm.c

7
src/wwm.c

@ -31,6 +31,10 @@ void ccheckAnswer(int useranswer) {
printf("Congratulations! You have won %d $!", geld);
exit(0);
}
if (useranswer < 1 || useranswer > 4) {
printf("Please enter a number beetween 1 and 4 or enter 5 to end the game!\n");
ceingabe();
}
}
int ceingabe() {
@ -40,7 +44,8 @@ int ceingabe() {
printf("Please enter a number beetween 1 and 4 to answer or 5 to end the game!\n");
while (getchar() != '\n')
return ceingabe();
return useranswer;
ccheckAnswer(useranswer);
return useranswer;
}
};

Loading…
Cancel
Save