its a random number generator

#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include <iomanip.h>
using namespace std;
int main ()
{
const int MAX_RANGE = 100;    
int value;
int random = rand( );
int num = ((random % 100) + 1);
int quit;

do
{
srand (time (NULL));
value = rand() % MAX_RANGE + 1;

cout << value<<endl;
cout << "Enter 0 to end program: ";

cout << "Guess a number between 1 and 100: ";
cin >> value;

if (value > num)
{
cout << "The number is lower. Try Again\n";
}
if (value < num)
{
cout << "The number is higher. Try Again\n";
}
else if (value == num)
{
cout << "You've guessed correctly\n";
system ("pause");
cin >> quit;
}
while (quit != 0);
}

Don't know. What it do wrong? If you want help you really need to explain. Read the Member Rules.

The thing I noticed is your srand() is in the wrong place. Put it at the beginning of the program so it's called only once.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.