diff --git a/build/test/out/c/casualQuiz.o b/build/test/out/c/casualQuiz.o index 6db6dfd..49e749f 100644 Binary files a/build/test/out/c/casualQuiz.o and b/build/test/out/c/casualQuiz.o differ diff --git a/build/test/out/test_casualQuiz.out b/build/test/out/test_casualQuiz.out index b7235ea..0169935 100755 Binary files a/build/test/out/test_casualQuiz.out and b/build/test/out/test_casualQuiz.out differ diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index 0f88edb..e6f4a09 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -45,4 +45,4 @@ - Right Answer, well done. - Wrong Input! - Wrong Input! -:time: 0.034674599999561906 +:time: 0.03563229998690076 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index ff4134e..6c3f8de 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.013722000003326684 +:time: 0.01542800001334399 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 7957b2c..7283a5f 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.013790600001811981 +:time: 0.015153000014834106 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index 037c63a..90979a7 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.014121699990937486 +:time: 0.014826200000243261 diff --git a/src/casualQuiz.c b/src/casualQuiz.c index 42a4ab1..536c033 100644 --- a/src/casualQuiz.c +++ b/src/casualQuiz.c @@ -7,7 +7,7 @@ void casualQuiz() { printf("Print aus der Funktion Casual Quiz"); - int index = 0; + 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 are one of the most recognisable symbols of which political ideology?", @@ -16,18 +16,18 @@ void casualQuiz() { {"Elsa", "Rapunzel", "Cinderella", "Pocahontas"}, {"Republicanism", "Liberalism", "Conservatism", "Communism"}, }; - int easy_richtigeAntworten[] = { 3,4}; // int, um die jeweils richtige antwort zu zeigen + int easy_richtigeAntworten[] = { 3,4 }; // int, um die jeweils richtige antwort zu zeigen - int length_frag_array = sizeof(easy_richtigeAntworten)/sizeof(int); + int length_frag_array = sizeof(easy_richtigeAntworten) / sizeof(int); int correct = 0; int answered = 0; - int *correctP = &correct; - int *answeredP = &answered; + int* correctP = &correct; + int* answeredP = &answered; - activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array, answeredP, correctP); + activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array, answeredP, correctP); printf("korrekte Antworten: %d\n", correct); printf("bei: %d beantworteten Fragen", answered); - return; + return; } void activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], int size, int* answeredP, int* correctP) { int eingabe; @@ -40,16 +40,7 @@ void activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], in printf("Please type in your answer 1,2,3 or 4: "); eingabe = FEingabeInteger(); richtig = FcheckaufRichtigkeit(eingabe, richtige_antwort, i); - if (richtig == true){ - int plus = *answeredP + 1; - *answeredP = plus; - int add = *correctP + 1; - *correctP = add; - } - else{ - int plus = *answeredP + 1; - *answeredP = plus; - } + FzaehlernachAuswahl(richtig, answeredP, correctP); printf("Bool richtig / falsch: %d\n", richtig); printf(" %d\n", richtige_antwort[i]); } @@ -113,4 +104,17 @@ bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { } } return false; +} +void FzaehlernachAuswahl(bool richtig, int* answeredP, int* correctP) { + if (richtig == true) { + int plus = *answeredP + 1; + *answeredP = plus; + int add = *correctP + 1; + *correctP = add; + } + else { + int plus = *answeredP + 1; + *answeredP = plus; + } + return; } \ No newline at end of file diff --git a/src/casualQuiz.h b/src/casualQuiz.h index 55dff24..63507a9 100644 --- a/src/casualQuiz.h +++ b/src/casualQuiz.h @@ -7,5 +7,6 @@ void FzeigeFragen(char *fragen[], int index); void FzeigeAntworten(char *antworten[], int index); int FEingabeInteger(); bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[],int i); +void FzaehlernachAuswahl(bool richtig, int* answeredP, int* correctP); #endif // ende CASUALQUIZ_H