5 Vowels The text file vowelstxt contains a paragraph of tex
5. Vowels The text file “vowels.txt” contains a paragraph of text. It has words in mixed upper and lower case. Write a C++ program that reads this file and counts the number of digits, vowels, and remaining characters that are not in the alphabet set [A..Z]. Show the output on the screen.
Solution
#include <iostream>
 #include <fstream>
 #include<cctype>
 using namespace std;
int main() {
ifstream fin;
 fin.open(\"vowels.txt\", ios::in);
char ch;
 int digit = 0,vowel=0,non=0;
while (!fin.eof() ) {
   fin.get(ch);
        if (isdigit(ch)){
            ++digit;
        }
 else if(ch==\'A\'||ch==\'a\'||ch==\'e\'||ch==\'E\'||ch==\'i\'||ch==\'I\'||ch==\'o\'||ch==\'O\'||ch==\'u\'||ch==\'U\')
  {
 ++vowel;
 }
 else
 ++non;
    }
 cout <<\"no of digits :\"<<digit<<\"\  no of vowels :\"<<vowel<<\"\  no of special chars :\"<<non;
 return 0;
 }

