Browse Source

Added Crossword Puzzle Mini-Game

main
fdlt3885 2 years ago
parent
commit
fd6c7582ed
  1. 36
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

36
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(){ void v_play_rockpapersciss(){
int player_choice, computer_choice, player_score = 0, computer_score = 0; 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("14. Guess Barack Obama's birth Year!\n");
printf("15. Germany Quiz!\n"); printf("15. Germany Quiz!\n");
printf("16. Breaking Bad 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: "); printf("Enter your choice: ");
scanf("%d", &choice); scanf("%d", &choice);
v_progress_bar(argc,argv); v_progress_bar(argc,argv);
@ -2969,6 +2999,10 @@ int main(int argc, char *argv[]) {
jump_to_menu = 1; jump_to_menu = 1;
break; break;
case 17: case 17:
b_crossword();
jump_to_menu = 1;
break;
case 18:
printf("\nThank you for trying our C code!\n"); printf("\nThank you for trying our C code!\n");
break; break;
default: default:

3
src/main/quizproject.h

@ -116,6 +116,9 @@ void b_germanyquiz();
//Breaking Bad Quiz Headers //Breaking Bad Quiz Headers
void b_BreakingBquiz(); void b_BreakingBquiz();
//Crossword Headers
void b_crossword();
#define NUM_QUESTIONS 5 #define NUM_QUESTIONS 5

Loading…
Cancel
Save