How do i sort my data file in c++? I can't sort it in while(!name.eof()). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i sort my data file in c++? I can't sort it in while(!name.eof()).

File Handling, Sorting

28th May 2021, 3:27 PM
Shasha
Shasha - avatar
5 Answers
+ 4
This is also possible: while (source.getline (buf, 256)) { ... }
28th May 2021, 4:05 PM
JaScript
JaScript - avatar
+ 3
while (source.get (ch)) { ... } while (source >> ch) { ... } while (!source.eof()) { ... }
28th May 2021, 3:56 PM
JaScript
JaScript - avatar
28th May 2021, 3:31 PM
JaScript
JaScript - avatar
+ 1
Thank you for the idea. I have an idea about sorting, but i need to sort inside the .txt file.
28th May 2021, 3:35 PM
Shasha
Shasha - avatar
+ 1
https://code.sololearn.com/cc5Zb857OQ58/?ref=app Sorry for late reply 😅. This is my code. I want to get first the 'percentage' on .dat file for sorting. But the percentage is 0 only. I changed my .txt file into .dat file.
29th May 2021, 1:03 AM
Shasha
Shasha - avatar