Strings C programming
Create an interactive word guessing game that gives the user up to 7 incorrect letters to guess the word.
Use the following array of char* for the word dictionary:
char *words[] = { "APPLE","ORANGE","BANANA","CAT","DOG","ELEPHANT",
"CAR","TRUCK","VAN","HAT","SHIRT","PANTS",
"MAN","WOMAN","CHILD","VAMPIRE","WEREWOLF","ZOMBIE",
"QUEEN","KING","KNAVE","PIANO","GUITAR","XYLOPHONE",
"WATCH","CLOCK","SUNDIAL","BELIEVER","ATHEIST","AGNOSTIC"} ;
A challenge word for the game should be selected randomly from that list using the rand() function, which should be seeded using the srand() function. Note that the challenge words have varying lengths, so I suggest that you create a variable length array of chars that is the same length as the challenge word (see the strlen function) and initialize it to contain all ‘*’ chars. I do NOT want to see any use of dynamic allocation (malloc or calloc) in your solution, as we haven’t covered that yet.
Once the challenge word has been established, continually prompt the user for a guess until they either complete the word or have made 7 wrong guesses. Before each prompt, show the current progress, including the number of guesses remaining, as illustrated in the example run below. The user should be allowed to enter their guesses in either lower or upper case (the toupper or tolower functions will be useful). When the current game is over, indicate whether they won or lost and reveal the challenge word. Then ask if they wish to play again, accepting either ‘Y’ or ‘y’ as an answer.
Student Name, ID:00999999, C programming , Winter 2017, Hw #7
Your word is *****
Enter a letter guess: A
I found it, you have 7 guesses left
Your word is *A***
Enter a letter guess: e
Not found, you have 6 guesses left
Your word is *A***
Enter a letter guess: i
Not found, you have 5 guesses left
Your word is *A***
Enter a letter guess: o
Not found, you have 4 guesses left
Your word is *A***
Enter a letter guess: p
Not found, you have 3 guesses left
Your word is *A***
Enter a letter guess: t
I found it, you have 3 guesses left
Your word is *AT**
Enter a letter guess: r
Not found, you have 2 guesses left
Your word is *AT**
Enter a letter guess: s
Not found, you have 1 guesses left
Your word is *AT**
Enter a letter guess: h
I found it, you have 1 guesses left
Your word is *AT*H
Enter a letter guess: w
I found it, you have 1 guesses left
Your word is WAT*H
Enter a letter guess: c
Good Job, you're done!
Your word was WATCH
Play again (Y or N)? y
Your word is *****
Enter a letter guess: a
I found it, you have 7 guesses left
Your word is ***A*
Enter a letter guess: e
Not found, you have 6 guesses left
Your word is ***A*
Enter a letter guess: i
Not found, you have 5 guesses left
Your word is ***A*
Enter a letter guess: t
Not found, you have 4 guesses left
Your word is ***A*
Enter a letter guess: s
Not found, you have 3 guesses left
Your word is ***A*
Enter a letter guess: w
I found it, you have 3 guesses left
Your word is W**A*
Enter a letter guess: p
Not found, you have 2 guesses left
Your word is W**A*
Enter a letter guess: c
Not found, you have 1 guesses left
Your word is W**A*
Enter a letter guess: y
Not found, you have 0 guesses left
Your word was WOMAN
Play again (Y or N)?