Archived

This topic is now archived and is closed to further replies.

Anidem

The #include file for randomness

Recommended Posts

Cool, thanks. But can someone also help with this code:
There''s a parse error on line 29 before ''return''

#include <iostream.h>
#include <stdlib.h>

int const MAXIMUM_VALUE = 70;

int StarAt (int nGalaxy, int nX, int nY)
{
int x, y, nReturn;

srand (nGalaxy);
for (y = 0; y <= nY; y++)
{
for (x = 0; x < nX; x++)
{
nReturn = rand() % MAXIMUM_VALUE;
}
}
}
return nReturn; //line 19
}

int main()
{

return 0;
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You have 3

{

but you also have 4

}
.

Get rid of the last { before line 19 and you should be set. Your compiler is currently reading line 19 as outside of any function which is why it''s so confused.

Share this post


Link to post
Share on other sites