diff --git a/src/timequiz.c b/src/timequiz.c index 9c87e94..c7bb333 100644 --- a/src/timequiz.c +++ b/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[]) { + if (userAnswer == correctIndex + 1) { + printf("Correct!\n"); + (*score)++; + (*totalCorrectAnswers)++; + } + else { + printf("Wrong! The correct answer is: %d. %s\n", correctIndex + 1, answers[correctIndex]); + } }