I am creating a to do list project that will add items to a list, start listing things off one by one, printing out to do's based off of similar importance, and lastly to print the whole list. I have three files. 19ToDo.h, 19ToDo.cpp, and main.cpp. My four functions are addToList, getNextItem,
getByPriority, and printToDo. Everything seems to run smoothly except for the getByPriority always crashes the program? but I don't get an explanation as to why. I am just learning about header files and structures so i feel I didn't call the functions exactly how I should in main.
I haven't run your program, just looked over the code and found some errors:
1) In function getNextItem() is missed a return statement at end of body, or you should omit them and make your return type 'void'.
2) In main.cpp, line 20: Here you have an error which is very nasty, hard to detect. Maybe you don't get even a warning at your compiler. It's good style writing the literal first( ('y' == nextmove) instead of (nextmove == 'y').
Also I have seen that your programming style is C like.
Look at my code. That handles the same stuff like yours. But i have it written by using the facilities of C++.
Now it need't deal with range-errors of array access or its fixed sizes.
NudeRob I would love to use vectors but our teacher is requiring arrays :/ Thanks for the errors you noticed in code though!! After further debugging it seems like my priority isnt being copied to my matches[100] array but I can seem to figure out why