From b186a85ab011a78f819066d1946a92734befa677 Mon Sep 17 00:00:00 2001 From: Christian Reum Date: Tue, 6 Feb 2024 20:33:40 +0100 Subject: [PATCH] functional 21 (vorheriger 20): if Anweisung runden 1-5 --- src/wwm.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/wwm.c b/src/wwm.c index 9ceb782..0b1d413 100644 --- a/src/wwm.c +++ b/src/wwm.c @@ -102,6 +102,10 @@ void wwm(){ {"Au", "Ag", "Su", "Si"} }; + int correctAnswer2[] = { + 1, 3, 4, 2, 2 + }; + for (int r = 1; r <= 16; r++){ if (r == 16) { @@ -109,27 +113,28 @@ void wwm(){ return; } + if (r <= 5) { + printf("__________________________________________________ \n\n"); + printf("You are at stage %d and have %d $\n", runde, geld); + crandomNumber(); + printf("Question %d: %s\n", runde + 1, question[frage]); - printf("__________________________________________________ \n\n"); - printf("You are at stage %d and have %d $\n", runde, geld); - crandomNumber(); - printf("Question %d: %s\n", runde + 1, question[frage]); - - for (int i = 0; i < 4; i++) { - printf("%d. %s \n", i + 1, answers[frage][i]); - } + for (int i = 0; i < 4; i++) { + printf("%d. %s \n", i + 1, answers[frage][i]); + } - ceingabe(); - - - if (useranswer == correctAnswer[frage]) { - printf("That is correct!\n"); - runde++; - setGeld(runde); - } - else { - printf("That is a shame! That is wrong!\n You lost %d $", geld); - return; + ceingabe(); + + + if (useranswer == correctAnswer[frage]) { + printf("That is correct!\n"); + runde++; + setGeld(runde); + } + else { + printf("That is a shame! That is wrong!\n You lost %d $", geld); + return; + } } } }