diff --git a/src/timequiz.c b/src/timequiz.c index 9f22db7..f71806e 100644 --- a/src/timequiz.c +++ b/src/timequiz.c @@ -19,6 +19,8 @@ void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalC int isValidAnswer(int userAnswer); +void printQuizResult(int totalCorrectAnswers, int totalAnsweredQuestions); + void timequiz() { @@ -175,9 +177,9 @@ void timequiz() { } //Endnachricht - printf("\nQuiz finished!\n"); - printf("Your total score: %d out of %d\n", totalCorrectAnswers, totalAnsweredQuestions); + printQuizResult(totalCorrectAnswers, totalAnsweredQuestions); } + //Zufällige Frage auswählen int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { int questionIndex; @@ -208,3 +210,9 @@ void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalC int isValidAnswer(int userAnswer) { return (userAnswer >= 1 && userAnswer <= 4); } +//Ausgabe Endscore +void printQuizResult(int totalCorrectAnswers, int totalAnsweredQuestions) { + printf("\nQuiz finished!\n"); + printf("Your total score: %d out of %d\n", totalCorrectAnswers, totalAnsweredQuestions); +} + diff --git a/src/timequiz.h b/src/timequiz.h index ca65f16..19eff23 100644 --- a/src/timequiz.h +++ b/src/timequiz.h @@ -6,5 +6,6 @@ int getRandomQuestionIndex(int askedQuestions[], int totalQuestions); void displayQuestion(const char* question,const char* answers[], int correctIndex); void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers,const char* answers[]); int isValidAnswer(int userAnswer); +void printQuizResult(int totalCorrectAnswers, int totalAnsweredQuestions); #endif //ende TIMEQUIZ_H