Skip to content

Instantly share code, notes, and snippets.

@2hanX
Created June 20, 2020 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2hanX/5e06c3e02de38f7e79d3579969e48245 to your computer and use it in GitHub Desktop.
Save 2hanX/5e06c3e02de38f7e79d3579969e48245 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
string a;
cout << "Enter words (q to quit): " << endl;
int v = 0;
int c = 0;
int o = 0;
cin >> a;
while (a != "q")
{
if (isalpha(a[0]))
{
switch (a[0])
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
v++;
break;
default:
c++;
break;
}
}
else
o++;
cin >> a;
}
cout << v << " words beginnig with vowels" << endl;
cout << c << " words beginnig with consonants" << endl;
cout << o << " others" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment