i am trying to read into a file that has random names and addresses in it and i want to print out to the screen the name of anyone in that list who has a certain city in their address. I was thinking of using the .find function and then checking to see if the name of that city is, and then subtract the number of lines from that result to get the name. in other words, if on line 5, there is the city of chicago, i was thinking of using a go to find function and print out what's on the line of the name by subtracting the number of lines between the name and city of each person... i am not really sure if all this s possible but that's my plan for this, any help?
That could work (provided that this thing has constant formatting, which I somehow doubt) unless there is some guy named Washington.
I suggest that you should find "<name>" and "</name>", read the name string, then find the nearest "<city>" and "</city>" and read the city string. Then if city == "Boston", std::cout << name;, or whatever you want to do with it.
i have no idea whether it's constant formatting or not but what you suggested seems not too bad, however i am not sure where to start... once i find the "<name>" and </name>" how would i print out what's in between those?