Browse Source

added printoutoption function

main
fdlt3917 2 years ago
parent
commit
672314d01a
  1. 82
      src/main/quizproject.c
  2. 1
      src/main/quizproject.h

82
src/main/quizproject.c

@ -78,13 +78,7 @@ void fifty_fifty(int question_num) {
};
printf("%s\n",qC[question_num]);
}
void looping(char qS[][100], char qC[][100], char aS[]){
int k = 0;
while(k < 1){
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");
void printOutOption(char qS[][100], char qC[][100],char aS[]){
char response;
for (int i = 0; i < 1; i++){
printf("%s\n", qS[i]);
@ -109,88 +103,50 @@ int k = 0;
if(response == aS[i]){
score++;
correct(score);
fact(i);
} else {
wrong(score);
}
}
}
void looping(char qS[][100], char qC[][100], char aS[]){
int k = 0;
while(k < 1){
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");
printOutOption(qS,qC,aS);//2
if (score < 1) {
printf("You lost! Better luck next time\n");
break;
} else {
printf("\t\t--------------------Round 2-------------------\n\n");
printf(">>In this round you need to answer 2 questions correctly to move to Round 3<<\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 == 'F') {
fifty_fifty(i);
printf("Enter your answer (A, B, C, or D): ");
scanf(" %c", &response);
response = toupper(response);
}else if (response == 'H') {
hint(i);
printf("Enter your answer (A, B, C, or D): ");
scanf(" %c", &response);
response = toupper(response);
printOutOption(qS,qC,aS);//3
}
if(response == aS[i]){
score++;
correct(score);
} else {
wrong(score);
}
}
}
if (score < 1) {
printf("You lost! Better luck next time\n");
break;
} else {
printf("\t\t--------------------Round 3-------------------\n\n");
printf(">>In this round you need to answer 2 questions correctly to move to Round 4<<\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 == 'F') {
fifty_fifty(i);
printf("Enter your answer (A, B, C, or D): ");
scanf(" %c", &response);
response = toupper(response);
} else if (response == 'H') {
hint(i);
printf("Enter your answer (A, B, C, or D): ");
scanf(" %c", &response);
response = toupper(response);
}
}
printOutOption(qS,qC,aS);//3
if (response == aS[i]) {
score++;
correct(score);
} else {
wrong(score);
}
}
k++;
}
}
}
void ask_questions(void) {
char qS[][100] = {
"What is the name of the tallest mountain in the world?\n"

1
src/main/quizproject.h

@ -12,5 +12,6 @@ void hint(int);
void correct(int);
void wrong(int);
int score = 0;
void printOutOption(char [][100], char [][100],char []);
#endif
Loading…
Cancel
Save