Nusc
- 752
- 2
I need to write a function that reads words from a text file and writes the words to an output tex file while removing all duplicate words.
void remove_dup(string filename)
{
vector <string> a;
string word;
ifstream infile(filename.c_str());
if(infile.fail())
exit(0);
while(!infile.eof(0))
{
infile >> word;
I'm stuck.
Should I use if statement?
if( a.at(i) == a.at(i) )
a.erase(i,i); ?
else
{
void remove_dup(string filename)
{
vector <string> a;
string word;
ifstream infile(filename.c_str());
if(infile.fail())
exit(0);
while(!infile.eof(0))
{
infile >> word;
I'm stuck.
Should I use if statement?
if( a.at(i) == a.at(i) )
a.erase(i,i); ?
else
{