From b508ae72fd9b111914b4e12a88965a322664d84c Mon Sep 17 00:00:00 2001 From: Florian Baeseler Date: Mon, 5 Feb 2024 11:18:09 +0100 Subject: [PATCH] refactoring: Antworten anzeigen in eigene Funktion ausgelagert --- build/test/results/test_casualQuiz.pass | 2 +- build/test/results/test_quizduell.pass | 2 +- build/test/results/test_timequiz.pass | 2 +- build/test/results/test_wwm.pass | 2 +- src/casualQuiz.c | 12 ++++++++++-- src/casualQuiz.h | 1 + 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index cfc9e24..e9859c9 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.01318790001096204 +:time: 0.015043999999761581 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index cc67674..150a13f 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.012945800001034513 +:time: 0.01414919999660924 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index e1d82f2..ab8b5a8 100644 --- a/build/test/results/test_timequiz.pass +++ b/build/test/results/test_timequiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.013551599986385554 +:time: 0.015228500007651746 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index 2149996..5a2f9fd 100644 --- a/build/test/results/test_wwm.pass +++ b/build/test/results/test_wwm.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.014078999985940754 +:time: 0.014498500007903203 diff --git a/src/casualQuiz.c b/src/casualQuiz.c index 14f573d..96d25df 100644 --- a/src/casualQuiz.c +++ b/src/casualQuiz.c @@ -10,7 +10,7 @@ void casualQuiz() { int index = 0; char* easy_fragen[] = { //eingabe der Fragen in ein Array "Which Disney character famously leaves a glass shoe behind at a royal ball?", - "The hammer and sickle is one of the most recognisable symbols of which political ideology?", + "The hammer and sickle are one of the most recognisable symbols of which political ideology?", }; char* easy_antworten[][4] = { //Eingabe der zugehörigen Antworten in ein array {"Elsa", "Rapunzel", "Cinderella", "Pocahontas"}, @@ -25,9 +25,17 @@ void casualQuiz() { void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size ){ for (int i = 0; i < size; i++){ - printf("1) %s\n2) %s\n3) %s\n4) %s\n %d\n", antworten[4 * i + 0], antworten[4 * i + 1], antworten[4 * i + 2], antworten[4 * i + 3], richtige_antwort[i]); + FzeigeFragen(fragen, i); + FzeigeAntworten(antworten, i); + printf(" %d\n", richtige_antwort[i]); } } void FzeigeFragen(char *fragen[], int index){ printf("Question: %s\n", fragen[index]); } +void FzeigeAntworten(char *antworten[], int index){ + printf("1) %s\n", antworten[4 * index + 0]); + printf("2) %s\n", antworten[4 * index + 1]); + printf("3) %s\n", antworten[4 * index + 2]); + printf("4) %s\n", antworten[4 * index + 3]); +} \ No newline at end of file diff --git a/src/casualQuiz.h b/src/casualQuiz.h index bf01fa7..977cc27 100644 --- a/src/casualQuiz.h +++ b/src/casualQuiz.h @@ -4,5 +4,6 @@ void casualQuiz(); void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size); void FzeigeFragen(char *fragen[], int index); +void FzeigeAntworten(char *antworten[], int index); #endif // ende CASUALQUIZ_H