Computer Science Canada Bug using binary search need help for school |
Author: | Quakerstate98 [ Wed Apr 09, 2008 12:36 pm ] |
Post subject: | Bug using binary search need help for school |
Hey guys ok this project takes in a txt file of names and numbers, puts them into 2 vectors and using recursion and iteratvice w/e binary searches the user can input a name from the file and it will return their corresponding number. I have the program working but if the user types a incorrect name it crashes I cannot figure out how to get around this. To get to the error run the program for txt file input type in: phonelistbyname.txt for the program to not crash the name u can input after is AARON, ABNEY, PAUL works to make it crash input any name lower case, hopefully someone out here knows how to fix it :S compiling with win32 |
Author: | md [ Wed Apr 09, 2008 3:30 pm ] |
Post subject: | RE:Bug using binary search need help for school |
Without looking at your code... have you looked into std::map? I shall attempt to take a look later when I complete my final project. |
Author: | A.J [ Wed Apr 09, 2008 11:40 pm ] |
Post subject: | Re: Bug using binary search need help for school |
try converting everything to small letters and store it on another array and then binary search from there on...(make sure that u have a copy of the original input names so hat u can output them) |
Author: | Quakerstate98 [ Wed Apr 09, 2008 11:52 pm ] |
Post subject: | Re: Bug using binary search need help for school |
i would convert then to lower case but that would actually cost me marks because I'm going outside of the project specifications. Prof wants us to be able to work with his file that he gives us without having to change it up. Apreciate the suggestion, any other ideas? |
Author: | OneOffDriveByPoster [ Thu Apr 10, 2008 12:43 am ] |
Post subject: | Re: Bug using binary search need help for school |
Quakerstate98 @ Wed Apr 09, 2008 11:52 pm wrote: i would convert then to lower case but that would actually cost me marks because I'm going outside of the project specifications. Prof wants us to be able to work with his file that he gives us without having to change it up. Apreciate the suggestion, any other ideas? You don't have to change the file to change to lowercase within your program... |
Author: | md [ Thu Apr 10, 2008 10:42 am ] |
Post subject: | RE:Bug using binary search need help for school |
Using multiple vectors when one vector and a struct would do is poor form. |