C++ program to find the vowels and consonants in a string


#include<iostream.h>
#include<conio.h>
void main()
{
char a[25],*p[25],v[25],c[25];
int i,j,k=0,l=0;
cout<<"Enter the string\n\n";
cin>>a;
for(i=0;a[i]!='\0';i++)
{
p[i]=&a[i];
}
p[i]=&a[i];
for(i=0;*p[i]!='\0';i++)
{
if(*p[i]=='a'||*p[i]=='e'||*p[i]=='i'||*p[i]=='o'||*p[i]=='u')
{
v[k]=*p[i];
k++;
}
else
{
c[l]=*p[i];
l++;
}
}
v[k]='\0';
c[l]='\0';
cout<<"\n\nVowels\n\n";
for(i=0;v[i]!='\0';i++)
{
cout<<v[i]<<" ";
}
cout<<"\n\nConsonents\n\n";
for(i=0;c[i]!='\0';i++)
{
cout<<c[i]<<" ";
}
getch();
}

C++ program to find the vowels and consonants in a string

1 comment:

Anonymous said...

to supplement your understanding of the above topic , do visit the link posted below
http://www.fixoncloud.com/Home/LoginValidate/OneProblemComplete_Detailed.php?problemid=329