hi, i am trying to read a list of names from a txt file and then sort it out. Once sorted i will have to write them to a new txt file. i have done this method multiple times already, but this is the first time i have encountered this error D:. I don't know what i am doing wrong since i know i wrote the process of opening a new file correctly or at least it should be correct. Any suggestions will be great, thanks!
Is your program:
1) Not compiles
* Is other code compiles correctly, i. e. is your compiler configured properly?
* If it is, give us error message and corresponding code part.
2) Not running
* Are you sure that it is not a problem with automatically closing console?
* How do you run it?
* Is there any error messages?
3) Gives an error when run
* Is it system error message or error reported in console?
* Give us error message and input which leads to error.
4) Not giving correct results
* Tell what you entered, what you expected, and what you got.
* Are you sure that results you expected are correct?
Everytime i run my program, a message will pop out "insertSort.exe has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available." When i use getline in line 28, i get the 5 names that i listed down separated by '\n' in a file. I would then reorganize those names in alphabetical order. If i output the array in its new sorted organization, it works out fine. However, if i try to place the new sorted names into a new file, i get that error message.
i suppose to sort the names thats why location - 1 is there. But since list[5] doesnt exist like you said, i changed the the i <=5 to i<=4 instead and now it works! haha thanks for the point out!
@MiiNiPaa Probably becuase of Universities. Most universities give out strict instructions on what to do (including mine) So you dont have much of a choice even if you would LOVE to use vectors rather than arrays etc.