Write a C++ program in Microsoft Visual Studio 2019, use only strings and functions. You need to create a game using strings. First generate a random letter from A to Z, this is your key and is hidden from the players.   Ask player1 and player 2 to enter two strings of length 10.   The player whose strings contains the key alphabet will win.   If both the players have key alphabets, then the player for which it occurs earlier in the string will win.   Sample Input: As computer generate a random letter such as Key: S (This Key must not be visible to user ) After that player1 enter this input in string. Player1: ABDXSCJMNK; And player2 enter this input in string Player2: CSTUZWKMIJ Sample output: Player 2 wins.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter9: Records (struct)
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

 Write a C++ program in Microsoft Visual Studio 2019, use only strings and functions.

You need to create a game using strings. First generate a random letter from A to Z, this is your key and is hidden from the players.

 

Ask player1 and player 2 to enter two strings of length 10.

 

The player whose strings contains the key alphabet will win.

 

If both the players have key alphabets, then the player for which it occurs earlier in the string will win.

 

Sample Input:

As computer generate a random letter such as

Key: S (This Key must not be visible to user )

After that player1 enter this input in string.

Player1: ABDXSCJMNK;

And player2 enter this input in string

Player2: CSTUZWKMIJ

Sample output:

Player 2 wins.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning