Question
Can you please assist on how to tackle this one. its an application that simulates a simple guessing game similar to playing Lotto. The user
Can you please assist on how to tackle this one. its an application that simulates a simple guessing game similar to playing Lotto. The user
guesses six unique numbers between 1 and 39. The program (Lotto machine) also generates six
unique random numbers in the same range. The program compares the user's guess to the
set of random numbers generated and displays a score. The score says how many of the user's
numbers matches that of the program.
The random numbers are generated and the score of the game is calculated by the
class GuessingGame
The data member num stores the number (e.g. 6) of random numbers to be generated for the
game, fromNum (e.g. 1) stores the starting number and toNum (e.g. 39) stores the
ending number. generateNumbers() can generate and return unique or non-unique
random numbers. The getters simply return the relevant values stored in the data members.
score() returns the number of numbers correctly guessed by the user.
Use the qrand() and qsrand() functions in Qt to generate random numbers.
Implement the main() function so that the user can enter six numbers in the range 1 - 39
in one QInputDialog (using an appropriate separator, which should be indicated in the
QInputDialog). These numbers should then be compared to the six numbers generated by
GuessingGame. Display the score to the user using a QMessageBox. Give the user a choice to
play the game again before quitting the application.
The input entered by the user should be validated so that only six unique numbers in the range
1 - 39 are accepted.
It must be in c++ using Qt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started