Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<map>
- #include <fstream>
- using namespace std;
- int main()
- {
- map<string, int> mappa;
- fstream testo;
- string appoggio;
- bool trovato= false;
- testo.open("testo.txt", ios::in);
- while(!testo.eof())
- {
- testo>>appoggio;
- for(map<string, int>::iterator it= mappa.begin(); it!=mappa.end(); it++)
- {
- if(it->first==appoggio)
- {
- it->second++;
- trovato=true;
- }
- }
- if(!false)
- {
- mappa.insert(pair <string, int>(appoggio,1));
- }
- }
- for(map<string, int>::iterator it= mappa.begin(); it!=mappa.end(); it++)
- {
- cout<<"Parola: "<<it->first<<" Occ:"<<it->second;
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement