i have made the following but the user should get 10 chances to guess the right number. after the 10 guesses or if the the guesser gets it correct it should ask if the player wants to play again and react accordingly.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
int randomNumber = rand() % 1000 + 1;
int guess = 0;
cout << "\tThe Number Guessing Game\n\n";
do
{
cout << "Enter your guess (#1-1000): ";
cin >> guess;
if (guess < randomNumber)
cout << "Your guess was too low\n\n";
if (guess > randomNumber)
cout << "Your guess was too high\n\n";
} while (guess != randomNumber);
cout << "\nCongratulations! You've guessed the number.\n\n";
system("pause");
return 0;
}