String Search .....

This is a discussion on String Search ..... within the C++ Programming forums, part of the General Programming Boards category; Hi,
I'm suppose to search for a string in a file ...
forexample ...
The user enters the filename ... ...

before main()
declare struct with three stings as members-- first name, last name, and phoneNumber

in main()
declare array of the structs
declare int to act as index of array and assign it value of zero
declare ifstream and associate it with file
read data from file into array of structs, stripping away commas
search array of structs for given string be it a name or phone#
if given string found in array of struct print struc information to screen adding back the comma.

You can wrap it in a loop using a flag the user can change so the user can do more than one search per run of the program. You can use a flag that is changed if a match is found. After searching the entire container if the flag hasn't been changed then no match was found.