Browse Source

refactoring: Antworten anzeigen in eigene Funktion ausgelagert

remotes/origin/Florian
Florian Baeseler 11 months ago
parent
commit
b508ae72fd
  1. 2
      build/test/results/test_casualQuiz.pass
  2. 2
      build/test/results/test_quizduell.pass
  3. 2
      build/test/results/test_timequiz.pass
  4. 2
      build/test/results/test_wwm.pass
  5. 12
      src/casualQuiz.c
  6. 1
      src/casualQuiz.h

2
build/test/results/test_casualQuiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.01318790001096204
:time: 0.015043999999761581

2
build/test/results/test_quizduell.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.012945800001034513
:time: 0.01414919999660924

2
build/test/results/test_timequiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.013551599986385554
:time: 0.015228500007651746

2
build/test/results/test_wwm.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.014078999985940754
:time: 0.014498500007903203

12
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]);
}

1
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
Loading…
Cancel
Save