From 442abf7a897e2102f2b323e9ef40643a585158c4 Mon Sep 17 00:00:00 2001 From: Florian Baeseler Date: Wed, 7 Feb 2024 18:18:09 +0100 Subject: [PATCH] =?UTF-8?q?refactoring:=20Funktion=20activePlaying=20als?= =?UTF-8?q?=20bool=20definiert=20mit=20r=C3=BCckgabewert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/test/out/c/casualQuiz.o | Bin 10413 -> 10421 bytes build/test/out/test_casualQuiz.out | Bin 120806 -> 120806 bytes build/test/results/test_casualQuiz.pass | 2 +- build/test/results/test_quizduell.pass | 2 +- build/test/results/test_timequiz.pass | 2 +- build/test/results/test_wwm.pass | 2 +- src/casualQuiz.c | 9 +++++---- src/casualQuiz.h | 10 +++++----- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/build/test/out/c/casualQuiz.o b/build/test/out/c/casualQuiz.o index 0f743cdaaa476e54e25b61be35cf54a5b70cbee0..20bdd9f219540192a7154cae5b1d8c6070031b1e 100644 GIT binary patch delta 2337 zcmZ9NeQZ-z6u{5D?OVIOu6=FSZr#ed54r}}2Ou8&~q!48Ly%KB_W>wd6vk;UpQ$Twg=JW3z~-@RkAKrUf9${KTVpD8LyO zBR=J-3*ZDhf)OTUPtf|BjgwlcxY=z|M_O1R^^v~p0=j{cB-^K7XjqR+4DCJ7#`OX6 zF4HS7tv`cgr2FrV5r0|7@b`Bo(d^i-jA1@*q6K%45`ba<aH5`KW-nMK;LP^ zL;gpWZ~TusM!K5OH$RwjtY*iQHOd8aL-xM1fRIhuN<#x>>kEg1KVjlBbZ~iI2QV9T zE~oJ~A9XG#^Z+fWb2){-4%E3kTL8c}z@;VYEo#z}C9K%ThAMw&3$DJ7sAqzJYC4fEf9#684*=jaXQX zRzn=juX#u@i)h{Wyr{iE%xp>xN^b8>ftek$MwgcM#1fmg z_kmHVE_#J;xo7P_s5jD|7zjs_pwy}y0=SHYf#7OCC{3#2PZ_Jsk!qnVX zm}W0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V0_y1xB8z00}V)1Nh zrv`ieG86$dvD41lRc;{Cg#1t>Ta%|4if7w2Cr|HHrikqdO*$4SZN=I6=oEd=QHQ7K zd4~sIqSqX?_!cd3u2IYMz4j}-urHL+q;pAg`6y(233kQMGmGo6Bgq`h!L{bpS5SBoEKF573_Zwci2|P$n}(3PxU2$+ zJhZAuU_BYOR)=dyPsq!2VL_|^>lKCUz>gkto9NT-1H@>`uXJLG{^=e!D6QmCI_}wN z!cy6%a?7iQMsJ=JKJf)`ZVyz@saO9Xs5!cNQ?PdgbHh>Nel?)DUtF*)f*lZyeR$mO zN5QTLRt;MZ@p7>3bs)LpY7T*I5NwxVdjxx5u#W`$Ua&=Qa(SvNK+V-(savof!3II) zxZ`dC4+_UO1UoI*8Nt34?4n@52zEoTayZU>4F@QmOhB-?>jYdVU{J8<1xpH+6>OJa zuL*XjFg~l5tk1;TFs88QuIjNY#E!hfeye-BSnQ$v9GNPcA{?P!>fO@$o|kCA@?)KYbF diff --git a/build/test/out/test_casualQuiz.out b/build/test/out/test_casualQuiz.out index 2c3e15e438e00ca2b07de39eb82e5d1e11f69edb..82e74bf5dc19123cd3f43cfcbc6e3b9a1a5e33d7 100755 GIT binary patch delta 2308 zcmZ8iZERCj7=GV-+pgPf*LG!Hw^h0_VFSm8C`=fWeb~~uflRi= zIp?+)`;sp9C3Uq6zaQ&F%QSsZt9QspAd&6w6b1H9lp!1P``rt ztaWH(uTp=UUA8`s%h|)WFb=SOTMyw;76Tcpu$gv{|_JxM+WP$RDxPfgbuPiypYwB1!R zRsXsR0Xn>Yb}l4VeNLzM&+?AXh`QnWifxs?l0vG0d^EqZPTy?`fcgja1|%@6fW-EWI)> zxk=0Vn71;o(5q!_E`ToorjK%#epv7C81Zi!o8jN)z3EqcnU#ojKKJh%S zKcZrbG;&y}FBaE0XrZffR6h@nD~zru^ty)T6FM3qK&RDaD7CY7O6@+4^&1_O;(oM% zs0TFk2SP{r62~-PKU?H&?f=TVr?RT68X){3Z5qXv8h`|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uiz.pass index 3735c59..44a3e59 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -61,4 +61,4 @@ - Right Answer, well done. - Wrong Input! - Wrong Input! -:time: 0.03427539998665452 +:time: 0.0355944000184536 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index a0c8f10..e9adfd5 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.013956899987533689 +:time: 0.014935399987734854 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 992f361..c1e676a 100644 --- a/build/test/results/test_timequiz.pass +++ b/build/test/results/test_timequiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.018729900009930134 +:time: 0.017270599957555532 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index 0ea587d..b0d898e 100644 --- a/build/test/results/test_wwm.pass +++ b/build/test/results/test_wwm.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.01555840001674369 +:time: 0.015941800025757402 diff --git a/src/casualQuiz.c b/src/casualQuiz.c index a27ee61..f03c10a 100644 --- a/src/casualQuiz.c +++ b/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]); diff --git a/src/casualQuiz.h b/src/casualQuiz.h index 63507a9..8fd17e2 100644 --- a/src/casualQuiz.h +++ b/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 \ No newline at end of file