The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Okay, I didn't know where to post this...so here ya go. We have to write a "Sort the numbers" program for C++ class. The following program I wrote, works perfectly. Except for one thing. The first time you run the "Bubble" sort the lowest number is replaced with 0, and another number is randomly replaced. Everytime thereafter, if you run the "Bubble" sort it will work. But if you quit then try running it again and do a "Bubble" sort it will do the same thing. It doesn't make any since. I narrowed it down to the "Bubble" function I am pretty sure though. So if anyone could compile this and see whats wrong...it would be helpful. I am stumped. Also if no one knows what I am talking about, I can re-explain it. One more thing...does anyone know of any good C++ forums, that I might be able to get some better help at? Thanks in advance.

look at the for loop. it should be X<MaxNumbers-1. Why? Well you're reading past the end of the last element of the array (not really since you made it 10000 elements, but simply past the last defined element.)