String Display Problem...

I've finished the code but now for some reason, which I have yet to figure out, there is an additional 0 being put into the output which is pushing out the smallest number in the array. Hopefully you guys can give me a bit of help here because I have been trying for so long to figure this out.

You elements array is of size 6, but you only put in 5 things.
If you have and array and you initialize it with the = { x,x,x,x} and you do not set a value to everything, whatever you left out will automatically get initialized to 0.
You also have some logic flaws. Sometimes your code will work right, others it will not. Go through step by step, if you can not figure out just say something. Somebody is always here!

You elements array is of size 6, but you only put in 5 things.
If you have and array and you initialize it with the = { x,x,x,x} and you do not set a value to everything, whatever you left out will automatically get initialized to 0.

In regards to Enahs post, since an array element will automatically be initialized to 0 if: 1) you use an initializer list, and 2) you fail to specify a value for the element, you can initialize every element of an array to 0 very easily by doing this:

Code:

int myArray[20] = {0};

That initializes the first element of the array, and since all the other elements of the array do not have values specified, they will automatically be initialized to 0.

Alright, so I fixed the problems I was having and the only problem now is when i have to use cin.eof(). The problem is that it creates a 0 in the array. The big deal about this is that the 0 is brought into bubbleSort and now I have this extra value being sorted that I dont want. So I would put in like 1,2,3,4,5 then do ctrl-z, enter, ctrl-z, enter and then the sorted output is 0,1,2,3,4,5...how do i get rid of this extra zero?

I just hadn't gotten completely specific. The program is supposed to recieve a max of 25 randomly inputted characters and then sort them smallest to largest. We are supposed to include cin.eof() so that the user can exit anytime and it will display the inputted characters in order up to when they pressed ctrl-z, enter, ctrl-z, enter.

One while loop is for the cin.eof() so that the program can end early
and the other is for error checking the input