Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- using namespace std;
- int main()
- {
- {
- string inputword;
- int numberOfWords = 0;
- map <string, int> storage;
- //Ask user for input.
- cout << "Please enter any word you want and enter." << "\n"
- << "To end the program, type in 'stop' and push enter."
- << "\n" << "You typed following words: " << endl;
- while (inputword != "stop")
- {
- cin >> inputword;
- cout << endl;
- if (inputword == "stop")
- {
- break;
- }
- storage[inputword] ++;
- numberOfWords++;
- }
- for (auto it = storage.begin(); it != storage.end(); ++it)
- {
- cout << "Your input " << it ->first <<" has been entered: "<< it->second <<" time(s)." <<endl;
- cout << "\n";
- }
- cout << " " << storage.size() << endl;
- cout << numberOfWords << endl;
- }
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement