How to write a C++ Program to find out number of vowels in a string in C++ programming ?
C++ Program To Find Out Number Of Vowels In A Atring |
Solution:
//Program to find out number of vowels in a string.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{
clrscr();
char a[80];
int n=0;
cout<<"Enter a string: ";
gets(a);
for(int i=0;a[i]!='\0';i++)
if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')
++n;
cout<<"Number of vowels in the string: "<<n;
getch();
}
This C++ Program To Find Out Number Of Vowels In A Atring.