|
@ -28,12 +28,12 @@ void casualQuiz() { |
|
|
printf("%d", answered); |
|
|
printf("%d", answered); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size, int *answeredP, int *correctP ){ |
|
|
|
|
|
|
|
|
void activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], int size, int* answeredP, int* correctP) { |
|
|
int eingabe; |
|
|
int eingabe; |
|
|
int plus = *answeredP +1; |
|
|
|
|
|
|
|
|
int plus = *answeredP + 1; |
|
|
*answeredP = plus; |
|
|
*answeredP = plus; |
|
|
bool richtig; |
|
|
bool richtig; |
|
|
for (int i = 0; i < size; i++){ |
|
|
|
|
|
|
|
|
for (int i = 0; i < size; i++) { |
|
|
eingabe = 5; |
|
|
eingabe = 5; |
|
|
richtig = false; |
|
|
richtig = false; |
|
|
FzeigeFragen(fragen, i); |
|
|
FzeigeFragen(fragen, i); |
|
@ -41,52 +41,67 @@ void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], in |
|
|
printf("Please type in your answer 1,2,3 or 4: "); |
|
|
printf("Please type in your answer 1,2,3 or 4: "); |
|
|
eingabe = FEingabeInteger(); |
|
|
eingabe = FEingabeInteger(); |
|
|
richtig = FcheckaufRichtigkeit(eingabe, richtige_antwort, i); |
|
|
richtig = FcheckaufRichtigkeit(eingabe, richtige_antwort, i); |
|
|
|
|
|
printf("Bool richtig / falsch: %d\n", richtig); |
|
|
printf(" %d\n", richtige_antwort[i]); |
|
|
printf(" %d\n", richtige_antwort[i]); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
void FzeigeFragen(char *fragen[], int index){ |
|
|
|
|
|
|
|
|
void FzeigeFragen(char* fragen[], int index) { |
|
|
printf("Question: %s\n", fragen[index]); |
|
|
printf("Question: %s\n", fragen[index]); |
|
|
} |
|
|
} |
|
|
void FzeigeAntworten(char *antworten[], int index){ |
|
|
|
|
|
|
|
|
void FzeigeAntworten(char* antworten[], int index) { |
|
|
printf("1) %s\n", antworten[4 * index + 0]); |
|
|
printf("1) %s\n", antworten[4 * index + 0]); |
|
|
printf("2) %s\n", antworten[4 * index + 1]); |
|
|
printf("2) %s\n", antworten[4 * index + 1]); |
|
|
printf("3) %s\n", antworten[4 * index + 2]); |
|
|
printf("3) %s\n", antworten[4 * index + 2]); |
|
|
printf("4) %s\n", antworten[4 * index + 3]); |
|
|
printf("4) %s\n", antworten[4 * index + 3]); |
|
|
} |
|
|
} |
|
|
int FEingabeInteger(){ |
|
|
|
|
|
|
|
|
int FEingabeInteger() { |
|
|
int eingabeInt; |
|
|
int eingabeInt; |
|
|
scanf_s("%d", &eingabeInt); |
|
|
scanf_s("%d", &eingabeInt); |
|
|
return eingabeInt; |
|
|
return eingabeInt; |
|
|
} |
|
|
} |
|
|
bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[],int i){ |
|
|
|
|
|
switch(eingabe){ |
|
|
|
|
|
case 1:{ |
|
|
|
|
|
|
|
|
bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { |
|
|
|
|
|
switch (eingabe) { |
|
|
|
|
|
case 1: { |
|
|
printf("Case 1\n"); |
|
|
printf("Case 1\n"); |
|
|
if (richtige_antwort[i] == 1) printf("Right Answer, well done.\n"); |
|
|
|
|
|
|
|
|
if (richtige_antwort[i] == 1) { |
|
|
|
|
|
printf("Right Answer, well done.\n"); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
else printf("Wrong answer.\n"); |
|
|
else printf("Wrong answer.\n"); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case 2:{ |
|
|
|
|
|
|
|
|
case 2: { |
|
|
printf("Case 2\n"); |
|
|
printf("Case 2\n"); |
|
|
if (richtige_antwort[i] == 2) printf("Right Answer, well done.\n"); |
|
|
|
|
|
|
|
|
if (richtige_antwort[i] == 2) { |
|
|
|
|
|
printf("Right Answer, well done.\n"); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
else printf("Wrong answer.\n"); |
|
|
else printf("Wrong answer.\n"); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case 3:{ |
|
|
|
|
|
|
|
|
case 3: { |
|
|
printf("Case 3\n"); |
|
|
printf("Case 3\n"); |
|
|
if (richtige_antwort[i] == 3) printf("Right Answer, well done.\n"); |
|
|
|
|
|
|
|
|
if (richtige_antwort[i] == 3) { |
|
|
|
|
|
printf("Right Answer, well done.\n"); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
else printf("Wrong answer.\n"); |
|
|
else printf("Wrong answer.\n"); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case 4:{ |
|
|
|
|
|
|
|
|
case 4: { |
|
|
printf("Case 4\n"); |
|
|
printf("Case 4\n"); |
|
|
if (richtige_antwort[i] == 4) printf("Right Answer, well done.\n"); |
|
|
|
|
|
|
|
|
if (richtige_antwort[i] == 4) { |
|
|
|
|
|
printf("Right Answer, well done.\n"); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
else printf("Wrong answer.\n"); |
|
|
else printf("Wrong answer.\n"); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
default:{ |
|
|
|
|
|
|
|
|
default: { |
|
|
printf("Wrong Input!"); |
|
|
printf("Wrong Input!"); |
|
|
|
|
|
return false; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
return false; |
|
|
} |
|
|
} |