Hmm ok.. lil problem.
if i type over 15 or below 0, it does what i told it to and replies with error, enter number below 15 and over 0, but when i do it again, it just misses this part out and says nope, wrong answer.
i want it to keep saying enter number below 15 and over 0 every time i type a number over 15 and under 0 lol.
Code:
// Guessing Game
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int rNumber; // Random number variable
int Guess; // Your input variable
cout << "Welcome to Reece's, Guess the number game...\n\n\n\n\n";
// random number
srand(time(NULL));
rNumber = rand() % 15 + 1;
cout <<"Enter your answer: \n";
cin >> Guess;
do{
cout <<"ERROR! Enter a number above 0 but below 15.\n"; break;
} while(Guess > 15 || Guess < 0);
do
{
cout << "Nope, wrong answer... Guess again: \n";
cin >> Guess;
}
while(Guess != rNumber);
cout << "Congrats You Win!\n";
cout << "The Number is " << rNumber << endl;
system("PAUSE");
return 0;
}
can someone please point out what im doing wrong with the first do.. while loop plz.