From e02f658714ee794b5167464906e1aec789eb5b29 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Mon, 23 Jan 2023 11:34:29 +0000 Subject: [PATCH] correct function --- src/main/quizproject.c | 9 +++++++-- src/main/quizproject.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 46c20ac..81a4ca1 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -63,6 +63,12 @@ void displayInstructions(void) { displayGoodLuckMessage(); } +void correct(int score2){ + printf("\nCorrect!\n"); + printf("You have %d points now\n\n", score); +} + + void looping(char qS[][100], char qC[][100], char aS[]){// 5 printf("\t\t--------------------Round 1-------------------\n\n"); @@ -76,8 +82,7 @@ void looping(char qS[][100], char qC[][100], char aS[]){// 5 response = toupper(response); if(response == aS[i]){ score++; - printf("\nCorrect!\n"); - printf("You have %d points now\n\n", score); + correct(score); } else { printf("\nwrong!\n"); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 14efb66..ed964a0 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -7,7 +7,7 @@ void displayLifelineInstructions(void); void displayInstructions(void); void displayGoodLuckMessage(void); void ask_questions(void); - +void correct(int); int score = 0; #endif