From 053fecb77697c4bc59708337b1232bdc14893c85 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Fri, 3 Feb 2023 13:29:50 +0000 Subject: [PATCH] hint for round 5 of smart brain --- src/main/quizproject.c | 27 +++++++++++++++++++++++++++ src/main/quizproject.h | 1 + 2 files changed, 28 insertions(+) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 4c7d258..7932fde 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -35,6 +35,21 @@ void e_press_key_start() { e_start_game = toupper(e_start_game); } +void hint_anagram(int hint_num) { + char hint_questions[][100] = { + "d_v_l_p_e_t", + "i_t_r_a_i_nal", + "p_l__im_ge", + "o_e__t_on", + "p_p_la__on", + "p__g__ss", + "c_a__en_e", + "e_ce__en_e", + "al_o_ati__" + }; + printf("Here is your hint: %s\n",hint_questions[hint_num]); +} + void e_display_instruction() { printf("\t\t-------------------------------------------------------\n"); printf("\t\t To start this Quiz, here are the instructions\n"); @@ -322,6 +337,18 @@ void e_printout(char print_out_questn[][100], char questions[][100],int randArr[ printf("[%d] Guess is the correct word for this anagram: %s\n", i+1, print_out_questn[rNum]); printf("Answer: "); scanf("%s", usr_ans); + for(int j = 0; j < strlen(usr_ans); j++) { + if (toupper(usr_ans[j]) == 'H' && strlen(usr_ans) == 1) { + hint_anagram(rNum); + printf("Answer: "); + scanf("%s", usr_ans); + } + } + int p = 0; + while(p < strlen(usr_ans)) { + usr_ans[p] = tolower(usr_ans[p]); + p++; + } int k = 0; for (int j = 0; j < strlen(print_out_questn[rNum]); j ++){ if(usr_ans[j] == questions[rNum][j]) { diff --git a/src/main/quizproject.h b/src/main/quizproject.h index eb59ec6..67a4e9b 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -49,6 +49,7 @@ void guess_word_questions(void); void print_guess_word_question (char [][100], char [][100],char [][100], int []); void e_printout(char [][100], char [][100], int []); void e_anagram_questions(void); +void hint_anagram(int); //----smart_brain_header_end------- //Epic Game Headers