Browse Source

refactoring: Auslagerung von größenberechnung des arrays

remotes/origin/Florian
Florian Baeseler 11 months ago
parent
commit
e83cd7b74e
  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. 9
      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.01849400000355672
:time: 0.013279100006911904

2
build/test/results/test_quizduell.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.01689270000497345
:time: 0.013567399990279227

2
build/test/results/test_timequiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.016173199997865595
:time: 0.01407669999753125

2
build/test/results/test_wwm.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.016555199996219017
:time: 0.013050099980318919

9
src/casualQuiz.c

@ -18,12 +18,13 @@ void casualQuiz() {
};
int easy_richtigeAntworten[] = { 3,4}; // int, um die jeweils richtige antwort zu zeigen
activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten);
int length_frag_array = sizeof(easy_richtigeAntworten)/sizeof(int);
activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array);
return;
}
void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[]){
int length = sizeof(richtige_antwort)/sizeof(int);
for (int i = 0; i < length; i++){
void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size ){
for (int i = 0; i < size; i++){
printf(" %s\n1) %s\n2) %s\n3) %s\n4) %s\n %d\n", fragen[i], antworten[4 * i + 0], antworten[4 * i + 1], antworten[4 * i + 2], antworten[4 * i + 3], richtige_antwort[i]);
}
}

2
src/casualQuiz.h

@ -2,7 +2,7 @@
#define CASUALQUIZ_H
void casualQuiz();
void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[]);
void activePlaying(char *fragen[], char *antworten[], int richtige_antwort[], int size);
#endif // ende CASUALQUIZ_H
Loading…
Cancel
Save