diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 2f75b9b..fecb093 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -2421,6 +2421,35 @@ void b_BreakingBquiz() { } +//Crossword Puzzle + +void b_crossword(){ + char word[10] = "C--S-W-RD"; + char answer[10] = "CROSSWORD"; + + printf("Guess the word: %s\n", word); + + char letter; + int i; + for (i = 0; i < 9; i++) { + int correct = 0; + while (!correct) { + printf("Enter letter %d: ", i + 1); + scanf(" %c", &letter); + if (letter != answer[i]) { + printf("Incorrect letter, please try again!\n"); + } else { + word[i] = letter; + printf("Correct letter!\n"); + correct = 1; + } + } + printf("Guess the word: %s\n", word); + } + + printf("The word is: %s\n", word); +} + void v_play_rockpapersciss(){ int player_choice, computer_choice, player_score = 0, computer_score = 0; @@ -2898,7 +2927,8 @@ int main(int argc, char *argv[]) { printf("14. Guess Barack Obama's birth Year!\n"); printf("15. Germany Quiz!\n"); printf("16. Breaking Bad Quiz!\n"); - printf("17. Exit\n"); + printf("17. Mini-Game: Crossword Puzzle!\n"); + printf("18. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); v_progress_bar(argc,argv); @@ -2969,6 +2999,10 @@ int main(int argc, char *argv[]) { jump_to_menu = 1; break; case 17: + b_crossword(); + jump_to_menu = 1; + break; + case 18: printf("\nThank you for trying our C code!\n"); break; default: diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 9eae280..311b7fc 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -116,6 +116,9 @@ void b_germanyquiz(); //Breaking Bad Quiz Headers void b_BreakingBquiz(); +//Crossword Headers +void b_crossword(); + #define NUM_QUESTIONS 5