Write a program that selects a secret random number between 0 and 99.
Then it repeatedly asks the user to guess what the number is (until the guess it correctly).
So, e.g. if the program selected 7 as the secret number then the user might see
Enter your guess: 3
Wrong!
Enter your guess:4
Wrong!
Enter your guess:9
Wrong!
Enter your guess:7
You Got it!.....
Program does not end when the user guesses the correct answer, thats the problem.
This is what i have so far.......
#include <iostream>
using namespace std;
int main ()
{
int n;
int r= rand()%5;
cout<<"Guess the random number"<<endl;
do {
cout<<"Enter your guess"<<" ";
cin>>n;
if (n!=r) cout<<"Wrong!"<<endl;
else if (n=r) cout<<"You got it!"<<endl;