Mail Archives: djgpp/2001/04/25/02:59:29
On Wed, 25 Apr 2001 jfmcginnis95 AT surfbest DOT net wrote:
> void getScores (int b[], int num)
>
> {
>
> cout << endl;
>
> srand(time(NULL));
>
> for (int i=0; i < num; i++)
>
> b[i] =rand()%100;
>
> }
>
> If I enter 1 through 4 as the number variable for the array it seems to do
> fine. When I get a larger number of elements in the array though it will
> give me all zeros or huge numbers, positive and negative, that have not
> appeared to have gone through the %100 part of the function. Anyone have
> any ideas?
An idea: post a short complete program that can be compiled and run.
Your code snippet has too many unknowns to see what might go wrong. (For
exampe, how is b[] declared in the calling routine? how do you print the
resulting array? and so on, and so forth...)
- Raw text -