Browse Source

Funktion für Antwort und Score v2

remotes/origin/Pascal
Pascal Schneider 11 months ago
parent
commit
89ddc769dc
  1. 8
      src/timequiz.c

8
src/timequiz.c

@ -89,4 +89,12 @@ void displayQuestion(char* question, char* answers[], int correctIndex) {
} }
void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers, char* answers[]) { void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers, char* answers[]) {
if (userAnswer == correctIndex + 1) {
printf("Correct!\n");
(*score)++;
(*totalCorrectAnswers)++;
}
else {
printf("Wrong! The correct answer is: %d. %s\n", correctIndex + 1, answers[correctIndex]);
}
} }
Loading…
Cancel
Save