Hi Pumps,
You were very close ^_^
You just inverted the two variables in the getline :
while(getline(inputstringstream, line,' ')){ ...
I think you wanted to something like :
1 2 3 4 5
|
std::string part;
while(getline(line, part, ' '))
{
filelines.push_back(part);
}
| |
Few comments :
* the variable "inputstringstream" is not usefull, get rid of it.
* "year" : I don't know why you make such a computation with a vector etc. for getRank(). Wouldn't it be enough to make a function like
1 2 3 4
|
int getRank(int decade)
{
return 1900 + 10 * decade;
}
| |
If you really want to keep that same procedural logic, at least, put that in a function and don't mix it with the NameSurferEntry class.
And then, don't create a "list" of years each time you need one... just compute that only once in a static member variable for example. The best would be a function with a static variable. For example :
1 2 3 4 5
|
int getRank(int decade)
{
static std::vector<int> year = { 1900, 1910, 1920 };
return year.at(decade);
}
| |
But I don't see the point at all of all that complicated thing ^_^
That's really all, I think ^_^
Have fun