The data is grouped into tracks where a new track starts after each line break as shown above (in the actual data there are thousands of tracks). I am trying to write a program that will allow the user to enter a track number. The program will then output the entire track. For example
I need to write the program using classes. I am trying to write a class: class tracks that will contain all of the tracks. The user should be able to call on the class to output the desired track. I am not quite sure how to approach this problem. Any suggestions would be greatly appreciated.
Considering that the file has thousands of numerical values, it would be smart not to allocate them on the stack, otherwise, you're asking for a stack-overflow. It would be better to dynamically allocate a block of memory to store the extracted data. A vector my be useful. As for the class, I would recommend something like this: