mardi 18 décembre 2018

Repeating text in file - problems with a loop

I want my programme to read some stuff from a file, but add new elements to my list only if the element appeared for the 1st time. My problem is that I don't know how to check it. The loop would look like this:

file >> someData >> someData2;
if(someData appeared for the 1st time)                
            {
                add someData to list;
            }
else
            add someData2 to list2;

I know how to do everything inside the loops, but the condition inside if is problematic, since the programme doesn't remember previously read data.

Aucun commentaire:

Enregistrer un commentaire