Questa ti va bene?
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const string vocali = "aeiou";
bool is_vocale(const char & val)
{
return vocali.find(val) != std::string::npos;
}
int conta_lettere(string & str, const char & val)
{
return std::count(str.begin(),str.end(),val);
}
void conta_vocali (string& str);
int main ()
{
string str;
cout << "Stringa: ";
getline (cin, str);
cout << endl;
conta_vocali(str);
cout << endl << endl;
system ("pause");
return 0;
}
void conta_vocali (string& str)
{
std::transform(str.begin(),str.end(),str.begin(),tolower);
cout << "Totale vocale A = " << conta_lettere(str,'a') << endl;
cout << "Totale vocale E = " << conta_lettere(str,'e') << endl;
cout << "Totale vocale I = " << conta_lettere(str,'i') << endl;
cout << "Totale vocale O = " << conta_lettere(str,'o') << endl;
cout << "Totale vocale U = " << conta_lettere(str,'u') << endl;
cout << "Totale vocali presenti: " << (int)std::count_if(str.begin(),str.end(),is_vocale);
}