Write a c++ program to prompt the user to enter his name. The program should ask the user to guess the login password (generated randomly to be between 1000 – 9999). The user will try to guess the password digit by digit as follows: Guess the first digit of the password ****: 2 Sorry wrong guessing!!!. Guess the first digit of the password ****: 1 WOW you have a correct guess. Guess the second digit of the password 1***: 5 WOW you have a correct guess. Guess the third digit of the password 15**: 3 Sorry wrong guessing!!!. The user will have only three chances to guess a specific digit from the password. After 3 successive wrong guesses a $50 balance will be deduced from the user balance. For each correct guessing a $100 dollar will be added to his balance if it is a correct guess from the first trial, and a $75 dollar will be added to his balance if it is a correct guess from the second trial. Note that the user is granted a balance of $200 dollar on the game start. The user win a game round if he was able to guess the login password, he looses otherwise. At the end of the game the user should be prompted about his balance. The program should allow many rounds of the gam

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a c++ program to prompt the user to enter his name. The program should ask the user to
guess the login password (generated randomly to be between 1000 – 9999). The user will try
to guess the password digit by digit as follows:
Guess the first digit of the password ****: 2
Sorry wrong guessing!!!.
Guess the first digit of the password ****: 1
WOW you have a correct guess.
Guess the second digit of the password 1***: 5
WOW you have a correct guess.
Guess the third digit of the password 15**: 3
Sorry wrong guessing!!!.

The user will have only three chances to guess a specific digit from the password. After 3
successive wrong guesses a $50 balance will be deduced from the user balance. For each correct
guessing a $100 dollar will be added to his balance if it is a correct guess from the first trial,
and a $75 dollar will be added to his balance if it is a correct guess from the second trial. Note
that the user is granted a balance of $200 dollar on the game start.
The user win a game round if he was able to guess the login password, he looses otherwise. At
the end of the game the user should be prompted about his balance. The program should allow
many rounds of the game.

Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
ADT and Class
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education