diff --git a/src/timequiz.c b/src/timequiz.c index bf8eaec..37cdc0c 100644 --- a/src/timequiz.c +++ b/src/timequiz.c @@ -172,7 +172,7 @@ void timequiz() { printf("\nQuiz finished!\n"); printf("Your total score: %d out of %d\n", totalCorrectAnswers, totalAnsweredQuestions); } - +//Zufällige Frage auswählen int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { int questionIndex; do { @@ -180,14 +180,14 @@ int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { } while (askedQuestions[questionIndex] == 1); return questionIndex; } - +//Frage anzeigen void displayQuestion(char* question, char* answers[], int correctIndex) { printf("\nQuestion: %s\n", question); for (int i = 0; i < 4; i++) { printf("%d. %s\n", i + 1, answers[i]); } } - +//User-Eingabe Verarbeitung void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers, char* answers[]) { if (userAnswer == correctIndex + 1) { printf("Correct!\n"); @@ -198,7 +198,7 @@ void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalC printf("Wrong! The correct answer is: %d. %s\n", correctIndex + 1, answers[correctIndex]); } } - +//Prüfung auf gültige Antwort int isValidAnswer(int userAnswer) { return (userAnswer >= 1 && userAnswer <= 4); }