From 4b4617f4a7107261d689e733080ca905e785afb4 Mon Sep 17 00:00:00 2001 From: Pascal Schneider Date: Tue, 6 Feb 2024 00:35:19 +0100 Subject: [PATCH] =?UTF-8?q?Code=20f=C3=BCr=20Timequiz=20fertig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/timequiz.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/timequiz.c b/src/timequiz.c index 5a78f6d..41f2aa3 100644 --- a/src/timequiz.c +++ b/src/timequiz.c @@ -153,6 +153,11 @@ void timequiz() { printf("Answer (1-4): "); scanf_s("%d", &userAnswer); + while (!isValidAnswer(userAnswer)) { + printf("Invalid input. Please enter a number between 1 and 4: "); + scanf_s("%d", &userAnswer); + } + processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers[questionIndex]); totalAnsweredQuestions++;