Hello, I posted a thread regarding files not long ago, but I came across with a few more challenges along the way. The code is related to the slidding puzzle game.
Let's say I got the following .txt file:
Code:1 2 4 3 6 5 8 7 John 15 M 55 William 13 F 120
The board that you see is an unsolved puzzle that "John" and "William" managed to finish in, respectively, 55 and 120 seconds.
After the user finishes a puzzle he must enter his name ("John"), age("15) and gender ("M"). The program will write the information to the file and the time the user took to solve the puzzle ("John 15 M 55").
The program itself is supposed to make a top 5 with the best times and the info regarding the same. This means that whenever there's a new time, THE NEW TIME has to be compared with the ones already in that file.
Ok so, in the thread I talked about earlier I managed to retrieve the times from the file and put them in a vector and sort them out with the new time. Although there was nothing but the times themselves in the vector.
My problem is: How to retrieve the times out of the file, sort them out with the new time and reorganize the file with the respective user info and time.
Thanks in advance