Hid_Enigma
In Runtime
- Messages
- 154
When i try using the random number generator I receive two errors
the first one:missing type specifier - int assumed. Note: C++ does not support default-int
the second : 'srand' : redefinition; previous definition was 'function'
i have the ctime lib being called
to declare the generator I have: This line i copied from another program that works fine.
srand (time(0));
the program then goes to a function called GetTheNumber()
in main I have it coded as generated = GetTheNumber();
in the GetTheNumber function
int GetTheNumber ()
{
int generated;
generated = 1 + rand() % 1000;
return generated;
}
I want the numbers betweet 1 and 1000 randomly generated.
When I look at the other program everything looks the same. Any help would be appreciated
Thanks in advance
the first one:missing type specifier - int assumed. Note: C++ does not support default-int
the second : 'srand' : redefinition; previous definition was 'function'
i have the ctime lib being called
to declare the generator I have: This line i copied from another program that works fine.
srand (time(0));
the program then goes to a function called GetTheNumber()
in main I have it coded as generated = GetTheNumber();
in the GetTheNumber function
int GetTheNumber ()
{
int generated;
generated = 1 + rand() % 1000;
return generated;
}
I want the numbers betweet 1 and 1000 randomly generated.
When I look at the other program everything looks the same. Any help would be appreciated
Thanks in advance