This program will ask the user to input a string of maximum 40 characters and then it will count vowels in the given string.
#include<iostream.h> #include<conio.h> #include<stdio.h> void main() { int i=0; char st[40]; clrscr(); cout << “Enter Any String Maximum 40 Characters:”; gets(st); for ( int k=0; st[k]!=”; k++ ) { if ( st[k]==’a’ st[k]==’A’ st[k]==’e’ st[k]==’E’ st[k]==’i’ st[k]==’I’ st[k]==’o’ st[k]==’O’st[k]==’u’ st[k]==’U’) i++; } cout << endl << “The of Vowels in this string is = “ << i; getch(); Output is Enter Any String Maximum 40 Characters: tanmay The of Vowels in this string is = 2