From 4ebe7e2ca25cf95e574756fa6edf5f3c5d3d4e07 Mon Sep 17 00:00:00 2001 From: Pascal Schneider Date: Mon, 5 Feb 2024 23:39:25 +0100 Subject: [PATCH] =?UTF-8?q?While-Schleife=20f=C3=BCr=20Spiel?= 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 28f828b..9923be4 100644 --- a/src/timequiz.c +++ b/src/timequiz.c @@ -54,6 +54,11 @@ void timequiz() { memset(askedQuestions, 0, sizeof(askedQuestions)); srand((unsigned int)time(NULL)); + + while (elapsedTime < 60 && totalAnsweredQuestions < totalQuestions) { + int questionIndex = getRandomQuestionIndex(askedQuestions, totalQuestions); + askedQuestions[questionIndex] = 1; + } } int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) {