943,969 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 5072
  • C RSS
Oct 1st, 2006
0

Binary Search of an array of three strings

Expand Post »
I have a homework assignment that requires that I sort an array of Accounts that contains strings for ID, PIN, and balance. I believe that I need to sort the array based on the ID. And then I have to verify the ID that the user inputs to the accounts that have been read in using ifStream. How do I use Binary Search to compare strings?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jfinch99 is offline Offline
2 posts
since Oct 2006
Oct 1st, 2006
0

Re: Binary Search of an array of three strings

there are several examples and tutorials. I suggest you use a structure to hold the data for one account then put the structures in an array. That helps keep all the data together when sorting and searching. The actual algorithm you are looking for is almost the same as shown in the link I posted. Just change the comparison to use string compares instead of integer compares.
Last edited by Ancient Dragon; Oct 1st, 2006 at 3:07 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Oct 1st, 2006
0

Re: Binary Search of an array of three strings

Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jfinch99 is offline Offline
2 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: c programming help part 3
Next Thread in C Forum Timeline: Reading and Writing file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC