Browse Source

final score function for brain_whiz

main
parent
commit
4b71a227f7
  1. 34
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

34
src/main/quizproject.c

@ -47,9 +47,7 @@ void math_instruction(){
if( input1 == 1 ){
math_enter_game();
} else{
printf("\t\t-------------------------------------------------------\n");
printf("\t\t Sorry to see you go.\n ");
printf("\t\t-------------------------------------------------------\n\n");
goodbye_message();
}
}
@ -71,9 +69,7 @@ void math_choose_game() {
} else if(choose == 'B'){
e_math_ques();
} else {
printf("\t\t-------------------------------------------------------\n");
printf("\t\t Sorry to see you go.\n ");
printf("\t\t-------------------------------------------------------\n\n");
goodbye_message();
}
}
@ -742,6 +738,11 @@ void e_anagram_questions() {
e_printout(print_questions,questions, charArr2);
}
void final_score(){
printf("\t\t------------------------------------------\n");
printf("\t\t Your final score: %d\n", score);
printf("\t\t------------------------------------------\n");
}
void e_smart_brain() {
e_display_instruction();
@ -751,9 +752,10 @@ int input1;
e_ask_questions();
if(score >=4 && track_r2_score ==2) {
e_questions_r3();
}
guess_word_questions();
e_anagram_questions();
}
final_score();
score = 0;
track_r2_score = 0;
} else{
@ -807,9 +809,10 @@ void math_solution(char math_solutions[][10], int init1){
}
if(strlen(fact_answer) == k){
printf("right!\n");
score++;
printf("right! your score: %d\n", score);
}else {
printf("worng!\n");
printf("worng! your score: %d\n", score);
}
}
@ -881,11 +884,12 @@ void math_question2(){
}
void compare_answer(char compare, char character1, int count){
void compare_answer(char compare, char character1){
if (compare == character1) {
printf("Right!, score is: %d\n", count);
score++;
printf("Right!, score is: %d\n", score);
} else {
printf("Wrong!\n");
printf("Wrong! score is: %d\n", score);
}
}
@ -902,7 +906,6 @@ void math_introduction(){
}
void for_loop_print_question(char mathQuestions[][140], char mathPossible[][140], char character[]) {
int counter = 0;
for (int i = 0; i < 5; i++){
char user_answer;
printf("[%d]. %s",i+1, mathQuestions[i]);
@ -910,8 +913,7 @@ void for_loop_print_question(char mathQuestions[][140], char mathPossible[][140]
scanf(" %c", &user_answer);
user_answer = toupper(user_answer);
char character0 = character[i];
counter++;
compare_answer(user_answer, character0, counter);
compare_answer(user_answer, character0);
}
}
@ -923,6 +925,8 @@ void math_quiz_option(){
if(input1 == 1){
math_question2();
math_fact_lie_print();
final_score();
score = 0;
} else {
goodbye_message();
}

3
src/main/quizproject.h

@ -142,7 +142,7 @@ void b_historyevents();
void for_loop_print_question(char [][140], char [][140], char []);
void math_question2();
void compare_answer(char, char, int);
void compare_answer(char, char);
void math_introduction();
void math_fact_lie(int);
void math_fact_lie_solutions(int);
@ -150,6 +150,7 @@ void math_fact_lie_print();
void math_quiz_option();
void math_solution(char [][10], int);
void goodbye_message();
void final_score();
//-------brain_whiz_header_end-------------

Loading…
Cancel
Save