So I have data in a text like this:
Alaska 200 500
New Jersey 400 300
.
.
And I am using ifstream
to open it.
This is part of a course assignment. We are not allowed to read in the whole line all at once and parse it into the various pieces. So trying to figure out how to read each part of every line.
Using >>
will only read in "New" for "New Jersey" due to the white space/blank in the middle of that state name. Have tried a number of different things like .get()
, .read()
, .getline()
. I have not been able to get the whole state name read in, and then read in the remainder of the numeric data for a given line.
I am wondering whether it is possible to read the whole line directly into a structure
. Of course, structure
is a new thing we are learning...
Any suggestions?