Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C languege Al Hussein Technical Task Four After finishing the Task 2, you should show to the users how many guesses did it take

in C languege
image text in transcribed
image text in transcribed
image text in transcribed
Al Hussein Technical Task Four After finishing the Task 2, you should show to the users how many guesses did it take to find their secret number using a column in an image, the dimension of the image and the place of the column are shown in Figure 7. -150 150 -65 height -20- Figure Note that the height of the column will reflect the number of guesses, each guess will be equivalent to exactly 10 units of height. For example, if the number of guesses is 3 the height of the column will be 30, if the number of guesses is 5, the height of the column will 50, and so on. Task Five Modify the program you have to update the function startHangmanGame to implement the Hangman game, which works as follows: The program asks the user to select a category from one of the following: 1. Food 2. Objects. 3. Names. 4. Colors. As shown in Figure 8 Al Hussein Technical Choose a category: 1. Food. 2. Objects. 3. Names. 4. Colors. If the user enters one of the 4 numbers, the program will select a word from that category to play. If the user enters any other number, the program will display an error message "Invalid choice." and redisplay the categories and wait for a valid choice. The program will use the provided files (food.txt, objects.txt, names.txt, colors.Ext] which contain 15 words each to select a word from the user-selected category. The selected word should be chosen in random. You can use the rand function to generate random numbers in Chere is an example: tinclude tinclude #include int main() { Il to generate different numbers in each run 1/ for this program srand(time(NULL)); // generates a random number between 0 and 14 int x = rand() # 15; printf("%d ", x); return 0; } After the random word is chosen from the file that corresponds to the chosen category, the program will display underscores that correspond to the hidden word characters, along with the remaining attempts as shown in Figure 9. The word so far is: You have 5 remaining attempts. Figure The word in the Figure 9 above contains 4 letters only, and the user has 5 attempts. Then, the user enters a letter, the program checks whether this letter exists in the word or not. If it does not exist, the program will deduct 1 from the remaining attempt and redisplay the previous message again as shown on Figure 10. P Not quite! Try again! The word so far is: You have 4 remaining attempts. Figure 10 If the character exists in the word, the program will replace the underscore in that character's position with the character and redisplay the previous message as shown in Figure 11. i Correct! Keep going! The word so far is: --i. You have 4 remaining attempts. Figure 11 If the number of attempts gets to zero, a hard luck message will be printed to the user as shown in Figure 12 and the game will exit to the main menu. a Hard luck! You were not able to find the word. :( Figure 12 If the user finds all the letters before running out of attempts, a congratulations message will be printed to the user as shown in Figure 13 and the game will exit to the main menu Congratulations! You found the word

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

2-6. What are the six main categories of nonverbal signals? [LO-5]

Answered: 1 week ago