However, I am having great difficulty doing this. I can't seem to find a way to do it because when I output, it seems to write-over the previous output.txt. The only way I can think of doing this is making getline start from the bottom and work backwards up the txt file (instead of the usually working from top down).
Just checking if there is an easier way to achieve this goal, thanks!
Your code compiled and ran great inside Visual but when I run with Dev C++, output.txt is left as a copy of input.txt and thus some of the data originally inside output.txt is lost.
Do you happen to know why that is?
I tried to do this with a .txt full of strings instead but couldn't seem to get it to compile. Does set work with strings?
Yes, but you should change every int to std::string in code. Also strings in question are whitespace character (\n, \t, ' ') separated, so "Hello world" would be read as two strings.