I am trying to write a program in c++. I have a file that contains thousands of numeric entries sorted into four columns. The structure of the data looks something like the following:
3 0.2 0.5 6.2
4 0.1 0.6 6.2 //Track 1
2 0.8 0.5 0.6
2 0.6 0.5 0.4
1 0.8 0.4 2.1 //Track 2
2 0.5 0.4 2.4
4 0.6 0.8 2.5
2 0.3 0.1 0.9 //Track 3
8 0.6 0.8 0.7
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
Track Number: 3
output:
2 0.3 0.1 0.9
8 0.6 0.8 0.7
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.