are there any numbers in any of the items in your file, or could there be?
you need a way to know when to stop reading the 'item' column. if there are no digits in it, you can use that. If there are digits, you may have to read it as a line and iterate it backwards looking for spaces to pick off the columns, everything left after the third (from backwards) space is the item...
typedefdecltype(std::chrono::system_clock::now()) DateTime;
struct record
{
std::string item;
double price;
int quantity;
DateTime date;
};
Create a function to read a single record from file. JSYK input is hard, so you need to be careful to split stuff up correctly.
It is especially hard if there are no clear delimiters between items. Is it TAB-delimited? That would make your life about a billion times easier. If not, it can still be done, though. (I did it. It was fun!)
Let us know what separates columns, or if it is just spaces.