i have a text file with a list of information on it i.e. names, dates they were working etc. i want to search this file for a cetain name and i want to display all the dates this person was working ( the person is repeated several times in the file with different dates each time ). how do i do this? i just want the code to be basic but u can't figure it out
Read the file and every time you encounter the desired name, add the dates to the list (read: vector) of dates.
How does your thread title relate to that, btw?
You have to read every line in the text file and check whether the name appears in it.
Binary search would only work if the names in the file are sorted. And even then, it's a tricky business with text files - and unless the files you're working with are very, very huge, you wouldn't even gain anything.