Browse Source

refactoring: Funktion activePlaying als bool definiert mit rückgabewert

remotes/origin/Florian
Florian Baeseler 11 months ago
parent
commit
442abf7a89
  1. BIN
      build/test/out/c/casualQuiz.o
  2. BIN
      build/test/out/test_casualQuiz.out
  3. 2
      build/test/results/test_casualQuiz.pass
  4. 2
      build/test/results/test_quizduell.pass
  5. 2
      build/test/results/test_timequiz.pass
  6. 2
      build/test/results/test_wwm.pass
  7. 9
      src/casualQuiz.c
  8. 10
      src/casualQuiz.h

BIN
build/test/out/c/casualQuiz.o

BIN
build/test/out/test_casualQuiz.out

2
build/test/results/test_casualQuiz.pass

@ -61,4 +61,4 @@
- Right Answer, well done.
- Wrong Input!
- Wrong Input!
:time: 0.03427539998665452
:time: 0.0355944000184536

2
build/test/results/test_quizduell.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.013956899987533689
:time: 0.014935399987734854

2
build/test/results/test_timequiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.018729900009930134
:time: 0.017270599957555532

2
build/test/results/test_wwm.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.01555840001674369
:time: 0.015941800025757402

9
src/casualQuiz.c

@ -21,7 +21,7 @@ void casualQuiz() {
{"The End", "The Termination", "Pizza's ready", "Hotdog Time"},
{"12-Pack", "6-Pack", "Family Pack", "One-Pack"},
{"Metal", "Plastic", "Humans", "Water"},
};
int easy_richtigeAntworten[] = { 3,4,1,2,1 }; // int, um die jeweils richtige antwort zu zeigen
@ -32,8 +32,8 @@ void casualQuiz() {
int* answeredP = &answered;
bool already_played = false;
bool end = false;
while (end == false){
activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array, answeredP, correctP);
while (end == false) {
already_played = activePlaying(easy_fragen, *easy_antworten, easy_richtigeAntworten, length_frag_array, answeredP, correctP);
printf("korrekte Antworten: %d\n", correct);
printf("bei: %d beantworteten Fragen", answered);
correct = 0;
@ -41,7 +41,7 @@ void casualQuiz() {
}
return;
}
void activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], int size, int* answeredP, int* correctP) {
bool activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], int size, int* answeredP, int* correctP) {
int eingabe;
bool richtig;
for (int i = 0; i < size; i++) {
@ -56,6 +56,7 @@ void activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], in
printf("Bool richtig / falsch: %d\n", richtig);
printf(" %d\n", richtige_antwort[i]);
}
return true;
}
void FzeigeFragen(char* fragen[], int index) {
printf("Question: %s\n", fragen[index]);

10
src/casualQuiz.h

@ -2,11 +2,11 @@
#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);
bool 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();
bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[],int i);
bool FcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i);
void FzaehlernachAuswahl(bool richtig, int* answeredP, int* correctP);
#endif // ende CASUALQUIZ_H
#endif // ende CASUALQUIZ_H
Loading…
Cancel
Save