| | |
Binary Search of an array of three strings
![]() |
•
•
Join Date: Oct 2006
Posts: 2
Reputation:
Solved Threads: 0
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?
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.
![]() |
Similar Threads
- Behaviour of Binary Search Program (C)
- how do i apply this binary search into this libary program (Java)
- Binary Search on a text file (Java)
- binary search (C)
- binary search (C++)
Other Threads in the C Forum
- Previous Thread: c programming help part 3
- Next Thread: Reading and Writing file
| Thread Tools | Search this Thread |
* adobe api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking hardware highest homework i/o ide inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h






