diff --git a/build/test/dependencies/force_build b/build/test/dependencies/force_build new file mode 100644 index 0000000..e69de29 diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index d7facf6..43c95fa 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.06824730001972057 +:time: 0.027896299987332895 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index dcbbc23..7fc986b 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -51,4 +51,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.08023290001438 +:time: 0.028896299976622686 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index dae1768..4bfaa81 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.07155269998474978 +:time: 0.029049100005067885 diff --git a/src/casualQuiz.c b/src/casualQuiz.c index e69de29..20933cc 100644 --- a/src/casualQuiz.c +++ b/src/casualQuiz.c @@ -0,0 +1,87 @@ +#include +#include +#include + +#include "casualQuiz.h" + + +void casualQuiz() { + printf("Print aus der Funktion Casual Quiz"); + 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?", + }; + char* easy_antworten[][4] = { //Eingabe der zugehörigen Antworten in ein array + {"Elsa", "Rapunzel", "Cinderella", "Pocahontas"}, + {"Republicanism", "Liberalism", "Conservatism", "Communism"}, + }; + int easy_richtigeAntworten[] = { 3,4}; // int, um die jeweils richtige antwort zu zeigen + + int length_frag_array = sizeof(easy_richtigeAntworten)/sizeof(int); + int correct = 0; + int answered = 0; + int *correctP = &correct; + int *answeredP = &answered; + + activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array, answeredP, correctP); + printf("%d", answered); + return; +} +void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size, int *answeredP, int *correctP ){ + int eingabe; + int plus = *answeredP +1; + *answeredP = plus; + for (int i = 0; i < size; i++){ + eingabe = 5; + FzeigeFragen(fragen, i); + FzeigeAntworten(antworten, i); + printf("Please type in your answer 1,2,3 or 4: "); + eingabe = FEingabeInteger(); + switch(eingabe){ + case 1:{ + printf("Case 1\n"); + if (richtige_antwort[i] == 1) printf("Right Answer, well done.\n"); + else printf("Wrong answer."); + break; + } + case 2:{ + printf("Case 2\n"); + if (richtige_antwort[i] == 2) printf("Right Answer, well done.\n"); + else printf("Wrong answer."); + break; + } + case 3:{ + printf("Case 3\n"); + if (richtige_antwort[i] == 3) printf("Right Answer, well done.\n"); + else printf("Wrong answer."); + break; + } + case 4:{ + printf("Case 4\n"); + if (richtige_antwort[i] == 4) printf("Right Answer, well done.\n"); + else printf("Wrong answer."); + break; + } + default:{ + printf("Wrong Input!"); + 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 5b3c846..ae18d0f 100644 --- a/src/casualQuiz.h +++ b/src/casualQuiz.h @@ -2,7 +2,9 @@ #define CASUALQUIZ_H void casualQuiz(); - - +void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size, int *answeredP, int *correctP ); +void FzeigeFragen(char *fragen[], int index); +void FzeigeAntworten(char *antworten[], int index); +int FEingabeInteger(); #endif // ende CASUALQUIZ_H