|
@ -19,6 +19,8 @@ void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalC |
|
|
|
|
|
|
|
|
int isValidAnswer(int userAnswer); |
|
|
int isValidAnswer(int userAnswer); |
|
|
|
|
|
|
|
|
|
|
|
void printQuizResult(int totalCorrectAnswers, int totalAnsweredQuestions); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void timequiz() { |
|
|
void timequiz() { |
|
@ -175,9 +177,9 @@ void timequiz() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Endnachricht |
|
|
//Endnachricht |
|
|
printf("\nQuiz finished!\n"); |
|
|
|
|
|
printf("Your total score: %d out of %d\n", totalCorrectAnswers, totalAnsweredQuestions); |
|
|
|
|
|
|
|
|
printQuizResult(totalCorrectAnswers, totalAnsweredQuestions); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Zufällige Frage auswählen |
|
|
//Zufällige Frage auswählen |
|
|
int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { |
|
|
int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { |
|
|
int questionIndex; |
|
|
int questionIndex; |
|
@ -208,3 +210,9 @@ void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalC |
|
|
int isValidAnswer(int userAnswer) { |
|
|
int isValidAnswer(int userAnswer) { |
|
|
return (userAnswer >= 1 && userAnswer <= 4); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|