My program is all running fine except that it is reading a seemingly random seven-digit number at the end of the file to add an additional number to the file and I have not been able to figure out why. I was able to determine that it has something to do with the first while loop.
I have tried everything I can think of and one thing I have noticed is that when I change the global variable to the number of numbers I know are in the file (12) it will work perfectly. However, I am suppose to do this so that I do not know exactly how many numbers are in the file.
What the output in the new file is suppose to look like but with the extra number:
8
10
12
17
25
36
47
62
62
65
87
89
2972880 //However this last seven digit number is not suppose to be there...here is the code...
Hello bigzigzag. Your code actually worked correctly for me, it sorted the numbers with out adding any extra. My guess is that maybe your input file had a non-number in it. Try deleting your input file and remake it, just to be safe. If that doesn't work, maybe try having a little loop to go through your number array and clear all the numbers to 0 at the beginning of your code. Thank :D