filtering duplicate lines

i need to filter duplicate lines from a text. it should store input lines in a vector and call a function to filter. sorry i am obviously a beginner and struggling mightily.


vector <string>
using namespace;
int main(){

bool filter(vector<string> lines, string)
for (int i=0, i<lines.length, ++i){
if (string!=lines){

lines.pushback;
}
else

++i
}
cout<< <lines>
}
Well, that code doesn't even compile.
The first step is to get something simple which does compile, then build upon it, step by step.
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

int main()
{
    vector <string> lines;
    
    return 0;
} 


As for the function filter(), it needs to return a true or false value indicating whether or not the value was found in the vector. Based upon that result, the string should be inserted or not into the vector.
I am trying to use getline in order to push_back into a vector but the error claims no matching function
Ok, you'd need to post the whole of the code in order for anyone to see what is wrong.

Or as an absolute minimum, post the full error message issued by the compiler, verbatim, along with the code relating to that message.
Last edited on
Topic archived. No new replies allowed.