Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

General Requirements Write a program that assigns four letters (i.e. char) to four different variables (either randomly using the rand function or from a text

General Requirements Write a program that assigns four letters (i.e. char) to four different variables (either randomly using the rand function or from a text file named Secret_Letters.txt). Your program will ask the user to enter the number of games they wish to play (1 to 4) Your program use one character at a time to play the game and repeat this for the number of games the user wants to play. Maximum number of guesses for each game is 5 (defined as a constant NUMBER_OF_GUESSES) Each time the users guess is wrong, you should provide him with a hint indicating whether the letter come before or after the letter he/she is trying to guess.(alphabetically) If the player has used up all of their guesses, a message that the game is over should be displayed along with the letter they were trying to guess. When the number of games has been played, the program will end Additional Requirements: Make sure to check the grading rubric for programming projects to understand how your work will graded. Make sure to follow the instructions carefully including identifier names, format of the output, file name, etc. Make sure to comment your code adequately. Make sure to indent properly. Check the textbook to see how it should be done. Make sure to use self-documenting variable names Sample Output:

Welcome to the Letter Guessing Game

You will enter the number of games you want to play (1 - 4 games)

You have 5 chances to guess each letter

Let's begin:

--------------------------------

How many games do you want to play (1-4) 3

************************************

Let's play game 1

Enter a guess: e

the letter you are trying to guess comes before e

Enter a guess: c

the letter you are trying to guess comes before c

Enter a guess: a

You guessed it!!!

************************************

Let's play game 2

Enter a guess: t

the letter you are trying to guess comes before t

Enter a guess: a

the letter you are trying to guess comes after a

Enter a guess: p

the letter you are trying to guess comes before p

Enter a guess: n

the letter you are trying to guess comes before n

Enter a guess: g

the letter you are trying to guess comes after g

You did not guess the letter. It was m

***********************************

Let's play game 3

Enter a guess: g

the letter you are trying to guess comes after g

Enter a guess: m

the letter you are trying to guess comes after m

Enter a guess: t

the letter you are trying to guess comes before t

Enter a guess: r

the letter you are trying to guess comes before r

Enter a guess: s

the letter you are trying to guess comes before s

You did not guess the letter. It was n

Press any key to continue . . .

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

2. What is the business value of security and control?

Answered: 1 week ago