Title is ambiguous, but, basically, I have a text file with three columns - the first one is from T1 to T104 and means Try1, Try2..., second and third columns are the results in the particular try, separated by commas, (results from some game, let's say) given as integers. Each Try (T) is on a separate row. For example: T3 5, 3
What I need to do is be able to open the file and print the results for a given try (attempt). For example, if the user enters "T3" i need to print the results for T3 - "5" and "3" to say.
What approach do I take?
Here is what I have so far, but I can't quite get it working:
I know for sure that my condition in the if loop in the getCode function is not right - it now just prints everything.
You could use a stringstream to parse the line into fields.
(In this example I used a stringstream as a substitute fro an input file - the behaviour should be the same as an ifstream).