#include<iostream>
#include <fstream>
#include <cctype>
#include<ctffunc.h>
using namespace std;
void enterLetters(char list[], int limit);
void countVandCLetters(char list[], int limit);
const int LIMIT = 100;
int main()
{
char letters[LIMIT];
enterLetters(letters, LIMIT);
countVandCLetters(letters, LIMIT);
}
void enterLetters(char list[], int limit)
{
for (int i = 0; i < limit; i++)
{
cin >> list[i];
if (list[i] == '0')
break;
}
}
void countVandCLetters(char list[], int limit)
{
int vowel = 0;
int Consonant = 0;
char vowels[] = { 'a','e','o','u','i' };
char Consonants[] = { 'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z' };
for (int i = 0; i < limit; i++)
{
if (IsCharUpperA(list[i]))
list[i] = list[i] + 32;
for (int j = 0; j < 5; j++)
{
if (list[i] == vowels[j])
vowel++;
}
for (int j = 0; j < 21; j++)
{
if (list[i] == Consonants[j])
Consonant++;
}
}
cout << "Number Of vowels Letters is " << vowel << endl;
cout << "Number Of Consonants Letters is " << Consonant << endl;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter