Browse Source

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

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

5
src/wwm.c

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

Loading…
Cancel
Save