From d67e753fb7fd6558b6ba930461407103b791e2c2 Mon Sep 17 00:00:00 2001 From: Christian Reum Date: Tue, 6 Feb 2024 18:14:04 +0100 Subject: [PATCH] functional 16: Implementierung eingabe() --- src/wwm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/wwm.c b/src/wwm.c index 1f705f8..ee223e8 100644 --- a/src/wwm.c +++ b/src/wwm.c @@ -22,7 +22,10 @@ int crandomNumber() { } - +int ceingabe() { + scanf("%d", &useranswer); + return useranswer; +}; void wwm(){ @@ -74,10 +77,9 @@ void wwm(){ for (int i = 0; i < 4; i++) { printf("%d. %s \n", i + 1, answers[frage][i]); - - int useranswer; - printf("Your answer (1-4):"); - scanf("%d", &useranswer); + } + printf("Your answer (1-4):"); + ceingabe(); if (useranswer == correctAnswer[frage]) { @@ -86,9 +88,8 @@ void wwm(){ setGeld(runde); } else { - printf("What a shame! That is wrong!\n You lost %d $", geld); + printf("That is a shame! That is wrong!\n You lost %d $", geld); return; } } - } }