Question
Can you help me to finish this program in c++ Write a program that defines any integral number between [0 - 15], including 0 or
Can you help me to finish this program in c++
Write a program that defines any integral number between [0 - 15], including
0 or 15. The idea is that the user tries to guess this number. Every time the user
a number enters the console, the program tells you if the number is greater or less than
secret number, until the user finally guesses the secret number.
Program behavior:
1) At the beginning, the program asks the user to guess your secret number by means of the
console.
2) The user enters a number, and the program responds with the following output to the console
depending on the number you type:
to. "You guessed right, you guessed the secret number." In that case, the program ends.
b. "Your number is bigger than the secret number." The program asks you to try
again.
c. "Your number is smaller than the secret number." The program asks you to
try again.
d. The program continues in this way until finally the user guesses the
secret number
The program will be written with this structure:
#include
using namespace std;
class SecretNumber{
public:
void setSecretNum(int num){
}
void giveFeedBackToUser(int numEnteredByUser){
}
private:
int SecretNumber;
};
int main(){
// Instance an object of type SecretNumber
int numEnteredbytheUser;
SecretNum SecretNum;
// Define your secret number, [0,15], anyone in that interval; 5 for example.
SecretNumber.SecretNumber(5);
// Ask the user to guess your secret number
// cout , etc.
cin >> numEnteredbytheUser;
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