So, I have a file that contains a pattern of a string then an int alternating line by line.
Something like this:
John McClane
30
James Bond
150
Indiana Jones
50
In this example, I would set John McClane to a string variable and then 30 to an integer variable. My issue is dealing with two types. I want to use getline(), but that only works with strings.
Is there an efficient or "right" way of doing this?
getlineis the right start. Keep working on it. Maybe there's some way to parse a string into an integer? If you get stuck, try applying a web-based search engine to parts of the problem.std::stringfromgetlineto anint