//Other alternatives.
#include <iostream>
#include <string>
usingnamespace std;
int main(){
string sentence; //variable to hold the sentence
char ch; //variable to hold each character
string vow ("aeiou");
string con ("bcdfghjklmnpqrstvwqyz");
string dig ("0123456789");
int found;
int ctr_vow=0;
int ctr_con=0;
int ctr_dig=0;
int str_spe=0;
cout << "Enter a sentence:";
getline(cin, sentence); //get input from keyboard
//loop through every character in the string
for (int i=0; i < sentence.length(); i++){
ch= sentence.at(i); //assign current char to ch
found=vow.find(tolower(ch));
if (found!=string::npos)
ctr_vow++;
found=con.find(tolower(ch));
if (found!=string::npos)
ctr_con++;
}
cout << "Vowels: " << ctr_vow << endl;
cout << "Consonants: " << ctr_con << endl;
return 0;
}