Using >> to read in id and station and getline() to read in the string after station seems reasonable. You should be aware however, that >> will leave the delimiter char between inputs (in this case space char) in the input buffer, and the delimiting char will not be ignored by getline(), like it will be by another call to >>. Therefore, clearing the input buffer by calling ignore() with the appropriate parameter(s) before the call to getline() would be a good idea.
getline() will put everything after the station field on a given line of the file into a single string. You may or may not need to parse (break up) the input original input string into substrings depending on how you want to use the information in the string. The first set of substrings are delimited by commas in the name/address string and by slashes in the date/time string. Then within the name/address string you have spaces between first name and last name, and colon between hour, minute, second in the time string if you want to break the information down into even more discrete information fields. I think you could probably do one of the following to break the input strings into desired substrings based on the delimeter used, IF you need to:
1) If using STL strings, use find() to find all the delimiters in the input string and then substr() to extract each substring between any two consecutive delimiters.
2) If using C style strings use strtok() to find substrings based on the delimiters
3) Use an istringstream with getline() to find substrings based on delimiters
4) write your own function using delimiters to separate input string into substrings.
If you've never heard of 1-3 before, then you are probably expected to do 4 as part of the learning exercise.
If you don't know about structs or classes yet, then keeping all this information in parrallel arrays/vectors seems a possible solution to keeping all this information in memory until you can do something with it, like print a report. For example, you could have an array for each of the fields to be printed in the report printing out a single line of information for each ID. The report may or may not use all of the fields available in the input data file. Based on your description of the report it looks like you will need the following information: id, name/address for a given ID, number of station A per ID, number of station B per ID, number of station C per ID, etc, and total amount per ID. So I would delcare appropriate arrays/vectors for each of those fields. As you are reading the file and find a station char (A, B, C, etc) you could increment the appropriate value stored in the appropriate index of the appropriate array for that ID, irrespective of the date the transaction occurred. Once the invoice for a given ID is compeleted (or once the file is completely read if that's more appropriate) you can then calculate the total amount for each ID based on the number of each station in each array for that ID times the value of each station (provided elsewhere) and store the amount in the appropriate index of the amount array/vector.
NB: my resources indicate that substr() has several variants:
1) substr() returns a copy of the string calling substr()
2) substr(x) returns a string that starts at index x in the calling string and includes all of the remaining char in the original strings
3) substr(x, y) returns a string that starts at index x and includes, at most, y char.
Therefore if you knew that there were two delimiters (say / is the delimiter) in a given input string (say abc/defg/hij is the input string) at indexes 3 and 8, then parsing the string into three substrings based on position of the delimeters using substr() would probably be:
substring1 = inputString.substr(0, 3);
substring2 = inputString.substr(4, 7 - 3);
substring3 = inputString.substr(9);
if I didn't make a mistake.