The data file provided consists of trajectories of vehicles for 10 min (600s) with various fields such as
Time (s), Vehicle number, Longitudinal position (m), Lateral position (m), and Vehicle type. However,
the data that is logged-in in the datafile provided is according to the sequence of time and not with
respect to the vehicle number. For example, the data corresponding to vehicle number 2 is logged in
at various places starting with row no. 15, and ending at row no. 1612 (see the provided data file).
Ideally, we would like to see the trajectory of any given vehicle logged in continuously. For this to
happen, we need to process the data in such a way that all the data corresponding to a given vehicle
appears at one place. Write a code in CPP to process the data and create an output file in the format
described above.
captain obvious wonders why data that is already readable by a spreadsheet that can already sort the data any which way is being manhandled by c++?
That aside, just read the strings from the original file into a vector of some sort of class or struct that has the 5 fields, sort it on the desired value (s), and write it out with commas between the fields into a text file with .csv extension. So the first thing to do is make your container for the fields. Can you do that?
if it were ME doing this 'for real' (not homework) I would probably write each truck to its own sheet.