Browse Source

added fifty fifty lifeline and function

main
fdlt3885 2 years ago
parent
commit
80c78a2de0
  1. 13
      src/main/quizproject.c
  2. 1
      src/main/quizproject.h

13
src/main/quizproject.c

@ -72,6 +72,12 @@ void wrong(int score1){
printf("You have %d points now\n\n", score); printf("You have %d points now\n\n", score);
} }
void fifty_fifty(int question_num) {
char qC[][100] = {//6
"A.Mount Everest\nB.Uludag",
};
printf("%s\n",qC[question_num]);
}
void looping(char qS[][100], char qC[][100], char aS[]){// 5 void looping(char qS[][100], char qC[][100], char aS[]){// 5
@ -84,6 +90,13 @@ void looping(char qS[][100], char qC[][100], char aS[]){// 5
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): "); printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): ");
scanf(" %c", &response); scanf(" %c", &response);
response = toupper(response); response = toupper(response);
if (response == 'F') {
fifty_fifty(i);
printf("Enter your answer (A, B, C, or D): ");
scanf(" %c", &response);
response = toupper(response);
}
if(response == aS[i]){ if(response == aS[i]){
score++; score++;
correct(score); correct(score);

1
src/main/quizproject.h

@ -7,6 +7,7 @@ void displayLifelineInstructions(void);
void displayInstructions(void); void displayInstructions(void);
void displayGoodLuckMessage(void); void displayGoodLuckMessage(void);
void ask_questions(void); void ask_questions(void);
void fifty_fifty(int);
void correct(int); void correct(int);
void wrong(int); void wrong(int);
int score = 0; int score = 0;

Loading…
Cancel
Save