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. 7
      src/casualQuiz.c
  8. 8
      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. - Right Answer, well done.
- Wrong Input! - Wrong Input!
- Wrong Input! - Wrong Input!
:time: 0.03427539998665452
:time: 0.0355944000184536

2
build/test/results/test_quizduell.pass

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

2
build/test/results/test_timequiz.pass

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

2
build/test/results/test_wwm.pass

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

7
src/casualQuiz.c

@ -32,8 +32,8 @@ void casualQuiz() {
int* answeredP = &answered; int* answeredP = &answered;
bool already_played = false; bool already_played = false;
bool end = 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("korrekte Antworten: %d\n", correct);
printf("bei: %d beantworteten Fragen", answered); printf("bei: %d beantworteten Fragen", answered);
correct = 0; correct = 0;
@ -41,7 +41,7 @@ void casualQuiz() {
} }
return; 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; int eingabe;
bool richtig; bool richtig;
for (int i = 0; i < size; i++) { 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("Bool richtig / falsch: %d\n", richtig);
printf(" %d\n", richtige_antwort[i]); printf(" %d\n", richtige_antwort[i]);
} }
return true;
} }
void FzeigeFragen(char* fragen[], int index) { void FzeigeFragen(char* fragen[], int index) {
printf("Question: %s\n", fragen[index]); printf("Question: %s\n", fragen[index]);

8
src/casualQuiz.h

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