--- In [email protected], "Reepak" <reepakkumarma...@...> wrote:
>
> the following is number guessing game the randomize function is
> always choosing 41 as the guessing number. Please help
It looks like you are using Turbo C++, which is non-standard, but I
suspect that randomize() resets the (pseudo-)random number generator
so that subsequent calls to rand() returns the same sequence of values.
You need to set ('seed') the generator to a 'random' value, perhaps
something to do with the current time. It looks like you are using
Turbo C++ - does it support the gettimeofday() function which returns
the current time in seconds and microseconds, and srand() to seed the
rand() function? If so, include the following:
#include <sys/time.h>
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_usec);
John