bonjour,
j'ai une simple question qui me perturbe l'esprit, je vous met une partie du code en question.
ifstream fin("fichier.txt");
string mot;
map <string, int> table;
while(fin >> mot) {
if(table.count(mot)>0){
int nb = table.at(mot);
nb++;
if(nb > nbMax){
nbMax = nb;
motMax = mot;
}
table.erase(mot);
table.insert({mot,nb});
}
En gros, je veux savoir le nombre de fois qu'un mot apparait dans le fichier txt et trouver celui qui apparait le plus. Comment le code fait pour voir si un mot est déjà apparu dans le code auparavant?
merci