diff --git a/build/test/out/test_quizduell.out b/build/test/out/test_quizduell.out index 54daea9..8ddd540 100755 Binary files a/build/test/out/test_quizduell.out and b/build/test/out/test_quizduell.out differ diff --git a/build/test/out/test_timequiz.out b/build/test/out/test_timequiz.out index dd25bdf..8854777 100755 Binary files a/build/test/out/test_timequiz.out and b/build/test/out/test_timequiz.out differ diff --git a/build/test/out/test_wwm.out b/build/test/out/test_wwm.out index 23b1199..38e54ee 100755 Binary files a/build/test/out/test_wwm.out and b/build/test/out/test_wwm.out differ diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index 43c95fa..c798cc5 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.027896299987332895 +:time: 0.0723504000052344 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index 4fbcee0..b66751d 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.028896299976622686 +:time: 0.10005589999491349 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 4bfaa81..1e7dc4f 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.029049100005067885 +:time: 0.07419399998616427 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index 2c5990d..16a6841 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.029695000004721805 +:time: 0.06791360001079738 diff --git a/src/casualQuiz.c b/src/casualQuiz.c index 20933cc..1ffb4a4 100644 --- a/src/casualQuiz.c +++ b/src/casualQuiz.c @@ -32,35 +32,56 @@ void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], in int eingabe; int plus = *answeredP +1; *answeredP = plus; + bool richtig; for (int i = 0; i < size; i++){ eingabe = 5; + richtig = false; FzeigeFragen(fragen, i); FzeigeAntworten(antworten, i); printf("Please type in your answer 1,2,3 or 4: "); eingabe = FEingabeInteger(); - switch(eingabe){ + richtig = FcheckaufRichtigkeit(eingabe, richtige_antwort, 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]); +} +int FEingabeInteger(){ + int eingabeInt; + scanf_s("%d", &eingabeInt); + return eingabeInt; +} +bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[],int i){ + switch(eingabe){ case 1:{ printf("Case 1\n"); if (richtige_antwort[i] == 1) printf("Right Answer, well done.\n"); - else printf("Wrong answer."); + else printf("Wrong answer.\n"); break; } case 2:{ printf("Case 2\n"); if (richtige_antwort[i] == 2) printf("Right Answer, well done.\n"); - else printf("Wrong answer."); + else printf("Wrong answer.\n"); break; } case 3:{ printf("Case 3\n"); if (richtige_antwort[i] == 3) printf("Right Answer, well done.\n"); - else printf("Wrong answer."); + else printf("Wrong answer.\n"); break; } case 4:{ printf("Case 4\n"); if (richtige_antwort[i] == 4) printf("Right Answer, well done.\n"); - else printf("Wrong answer."); + else printf("Wrong answer.\n"); break; } default:{ @@ -68,20 +89,4 @@ void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], in break; } } - 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]); -} -int FEingabeInteger(){ - int eingabeInt; - scanf_s("%d", &eingabeInt); - return eingabeInt; } \ No newline at end of file diff --git a/src/casualQuiz.h b/src/casualQuiz.h index ae18d0f..55dff24 100644 --- a/src/casualQuiz.h +++ b/src/casualQuiz.h @@ -6,5 +6,6 @@ void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], in void FzeigeFragen(char *fragen[], int index); void FzeigeAntworten(char *antworten[], int index); int FEingabeInteger(); +bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[],int i); #endif // ende CASUALQUIZ_H