Delete Vowels from Given String in C++

Advertisements

Prev Tutorial Next Tutorial

C++ Program to Delete Vowels from Given String

To delete all the vowels (i.e., a, A, e, E, i, I, o, O, u, U) from the string in C++ program. In case of english alphabet their are 5 lower case letter and 5 captipal letter, in this programming code we remove all small as well as capital letter from given string. You can also see this code in C Programming Language, C Program to Delete Vowels from Given String

C++ Program to Delete Vowels from Given String

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
char str[20];
int len, i, j;
clrscr();
cout<<"Please Enter any String: ";
gets(str);
len=strlen(str);
for(i=0; i<len; i++)
{
if(str[i]=='a' || str[i]=='e' || str[i]=='i' ||
str[i]=='o' || str[i]=='u' || str[i]=='A' ||
str[i]=='E' || str[i]=='I' || str[i]=='O' ||
str[i]=='U')
{
for(j=i; j<len; j++)
{
str[j]=str[j+1];
}
len--;
}
}
cout<<"After Deleting the vowels, the String is:"<<str;
getch();
}

Output

Please Enter any String: Hitesh Kumar
After Deleting the vowels, the String is: Htsh Kmr

Output

Please Enter any String: Reetu
After Deleting the vowels, the String is: Rt

Output

Delete Vowels from Given String in C++
Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements