C++ Gradebook

SOLVED
Last edited on
And I also have to get random nubmers from 0-100. I get them only from 1-100.

This: rnd = rand() % 100 + 1; produces numbers between 1 and 100. If you want 0 to 100 try rnd = rand() % 101;.

Also since srand() should only be called once it is usually placed early in main().

Your "bubble" sort doesn't really look much like a true bubble sort. Perhaps you need to review your documentation for the sort?

Lastly a few more functions would greatly simplify your logic. For example why is random_number() doing so much. I would expect this function to only fill the supplied array with random numbers. You may want to consider a function that prints your array, one that sorts the array, etc.



Topic archived. No new replies allowed.