Browse Source

added looping function

main
fdlt3917 2 years ago
parent
commit
713378f9e8
  1. 27
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

27
src/main/quizproject.c

@ -60,7 +60,30 @@ void displayLifelineInstructions(void) {
void displayInstructions(void) {
displayWelcomeMessage();
displayLifelineInstructions();
displayWelcomeMessage();
displayGoodLuckMessage();
}
void looping(char qS[][100], char qC[][100], char aS[]){// 5
printf("\t\t--------------------Round 1-------------------\n\n");
printf(">>In this round you need to answer 3 questions correctly to move to Round 2<<\n\n");
char response;
for (int i = 0; i < 1; i++){
printf("%s\n", qS[i]);
printf("%s\n", qC[i]);
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): ");
scanf(" %c", &response);
response = toupper(response);
if(response == aS[i]){
score++;
printf("\nCorrect!\n");
printf("You have %d points now\n\n", score);
} else {
printf("\nwrong!\n");
printf("You have %d points now\n\n", score);
}
}
}
void ask_questions(void) {
@ -79,6 +102,8 @@ void ask_questions(void) {
'A'
};
looping(qS,qC,aS);
}

3
src/main/quizproject.h

@ -7,4 +7,7 @@ void displayLifelineInstructions(void);
void displayInstructions(void);
void displayGoodLuckMessage(void);
void ask_questions(void);
int score = 0;
#endif
Loading…
Cancel
Save