Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <format>
- #include <string_view>
- using namespace std;
- int main()
- {
- string frase = "QuEl ramo del lagO di Como ...";
- map<char, int> contatori;
- for (char c : "aeiouAEIOU"sv) contatori.insert(make_pair(c, 0));
- int cont_a = 0;
- for(char c: frase)
- {
- switch (const auto it = frase.find("ramo"); c)
- {
- case 'a':
- cont_a++;
- [[fallthrough]];
- case 'e':
- case 'i':
- case 'o':
- case 'u':
- case 'A':
- case 'E':
- case 'I':
- case 'O':
- case 'U':
- contatori[c]++;
- break;
- default:
- break;
- }
- }
- for (auto cont : contatori)
- cout << format("La vocale {} e' stata trovata {} volte.\n", cont.first, cont.second);
- if (const auto it = frase.find("ramo"); it != string::npos)
- cout << "Trovato ramo \n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement