From d7c9c601af98cf6522464e08fc35af433f4b21b9 Mon Sep 17 00:00:00 2001 From: Christian Reum Date: Sun, 4 Feb 2024 17:01:56 +0100 Subject: [PATCH] 8th functional commit --- src/wwm.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/wwm.c b/src/wwm.c index 0968318..2ed9873 100644 --- a/src/wwm.c +++ b/src/wwm.c @@ -12,19 +12,19 @@ void wwm(){ printf("You are at stage %d and have %d $\n", runde, geld); const char* question[] = { - "Which planet is known as the `blue planet`?", - "What is the capital of Germany?", - "What is the largest desert in the world?" + "Which planet is known as the `blue planet`?", + "What is the capital of Germany?", + "What is the largest desert in the world?" }; const char* answers[][4] = { - {"Mars", "Venus", "Earth", "Jupiter"}, - {"Munich", "Berlin", "Cologne", "Frankfurt am Main"}, - {"Antarctica", "Sahara", "Gobi", "Arctica" } + {"Mars", "Venus", "Earth", "Jupiter"}, + {"Munich", "Berlin", "Cologne", "Frankfurt am Main"}, + {"Antarctica", "Sahara", "Gobi", "Arctica" } }; int correctAnswer[] = { - 3, 2, 1 + 3, 2, 1 }; @@ -37,6 +37,19 @@ 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); + + + if (useranswer == correctAnswer[frage]) { + printf("That is correct!"); + } + else { + printf("That is wrong!"); + } + + return; }