Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Bug using binary search need help for school
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Quakerstate98




PostPosted: 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



Project4.rar
 Description:

Download
 Filename:  Project4.rar
 Filesize:  1.58 MB
 Downloaded:  409 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: 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.
A.J




PostPosted: 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)
Quakerstate98




PostPosted: 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?
OneOffDriveByPoster




PostPosted: 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...
md




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: