Thanks for that.
Now this is getting more complete, there is a need to address some of the fine details, dotting the i's and crossing the t's as it were.
One thing which stands out is the use of
input.ignore(',');
at lines 44 and 46.
You might instead have done this:
1 2
|
char dummy;
input >> dummy.
|
that simply reads the first non-whitespace character into the variable, which has no further use.
On the other hand to use ignore(), there are a number of choices, the once you used ignores a fixed number of characters from the file. How many? Well the ASCII code for the character ',' is decimal 44, so that code will read and ignore the next 44 characters from the file, which is definitely not what you want.
You could just use
input.ignore();
with no parameter, to ignore a single character - but it doesn't check whether it is whitespace or not. Another possibility is to use a number and a delimiter,
input.ignore(10, ',');
which will ignore up to 10 characters, or until the delimiter ',' is found.
see
http://www.cplusplus.com/reference/istream/istream/ignore/
I've gone into detail here, because you also need to ignore the newline character
'\n'
in two places
1. after reading the count x at line 37
2. after reading the bool pf at line 47.