Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <algorithm>
- using namespace std;
- int main(int argc, char **argv)
- {
- setlocale( LC_ALL,"Russian" );
- multimap<size_t, string> words;
- cout << "Введите слова (ctrl+z для остановки): " << endl;
- for(string word;;)
- {
- cin >> word;
- if (cin.eof())
- break;
- size_t vowel_count = count_if(word.begin(), word.end(),
- [](char c){ return string("aeiou").find_first_of(c) != string::npos; });
- words.insert(make_pair(vowel_count, word));
- }
- if (words.size() != 0)
- {
- double percent = (100.0*words.rbegin()->first) / words.rbegin()->second.size();
- cout << "word: " << words.rbegin()->second << endl;
- cout << "percent: " << percent << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement