Browse Source

zwei zähler-pointer zur Funktion activePlaying hinzugefügt für später

remotes/origin/Florian
Florian Baeseler 11 months ago
parent
commit
00616750fd
  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. 18
      src/casualQuiz.c
  6. 2
      src/casualQuiz.h

2
build/test/results/test_casualQuiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.013265200017485768
:time: 0.027896299987332895

2
build/test/results/test_quizduell.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.013494899991201237
:time: 0.028896299976622686

2
build/test/results/test_timequiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.012791300017852336
:time: 0.029049100005067885

2
build/test/results/test_wwm.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.013431600003968924
:time: 0.029695000004721805

18
src/casualQuiz.c

@ -19,11 +19,19 @@ void casualQuiz() {
int easy_richtigeAntworten[] = { 3,4}; // int, um die jeweils richtige antwort zu zeigen
int length_frag_array = sizeof(easy_richtigeAntworten)/sizeof(int);
activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array);
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 ){
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);
@ -33,19 +41,19 @@ void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], in
switch(eingabe){
case 1:{
printf("Case 1\n");
if (richtige_antwort[i] == 4) printf("Right Answer, well done.\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] == 4) printf("Right Answer, well done.\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] == 4) printf("Right Answer, well done.\n");
if (richtige_antwort[i] == 3) printf("Right Answer, well done.\n");
else printf("Wrong answer.");
break;
}

2
src/casualQuiz.h

@ -2,7 +2,7 @@
#define CASUALQUIZ_H
void casualQuiz();
void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size);
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();

Loading…
Cancel
Save