Jump to content
  • Advertisement

Archived

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

Anidem

The #include file for randomness

This topic is 5856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!