Jul 3, 2015 at 11:05am UTC
you have to include the library algorithm because std::unique is in there.
Add this to the other #include - directives
#include <algorithm>
Jul 3, 2015 at 11:10am UTC
I put them and still does not work
Jul 3, 2015 at 11:20am UTC
I am doing something wrong
please help!!
Last edited on Jul 3, 2015 at 11:56am UTC
Jul 3, 2015 at 12:00pm UTC
Oh no, I'm sorry, std::unique only works on sorted vectors and does something completely different, you want non-unique items but std::unique gives you all items exactly once...
seems like you have to invent your own algorithm for removing non-unique items
Jul 3, 2015 at 12:04pm UTC
and how they do it?
I need this
if I have in file1.txt
Line A
Line C
Line D
in the second file2.txt
Line B
Line C
Line D
Line E
the output file to appear :
Line C
Line D
in output file I must heve only the duble words D and C
Last edited on Jul 3, 2015 at 12:06pm UTC
Jul 3, 2015 at 12:14pm UTC
try it yourself, for loops are a good start
Jul 3, 2015 at 12:15pm UTC
There is nothing better in my program
can you help me?
Last edited on Jul 3, 2015 at 12:18pm UTC
Jul 3, 2015 at 12:23pm UTC
There is nothing good in my program?
Jul 3, 2015 at 12:24pm UTC
sure, your program works fine!
You just have to find a way to remove all unique elements.
Jul 3, 2015 at 12:27pm UTC
how I do this thing
I am a beginner and I need this project
help pls
Jul 3, 2015 at 12:28pm UTC
I am a beginner and I need this project
The only way to get better is by doing stuff yourself...
for (int i = 0; i < fileLines.size(); ++i) { /* do something with each element */ }
Last edited on Jul 3, 2015 at 12:29pm UTC
Jul 3, 2015 at 12:35pm UTC
I put for(int i = 0; i < fileLines.size(); ++i) in my main program
I promise you I study what you show me on this program
Last edited on Jul 3, 2015 at 12:37pm UTC
Jul 3, 2015 at 1:00pm UTC
That won't do anything yet...
You have the chance to study by inventing your algorithm, that's far more efficient! ;)