- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
To delete all the vowels from the string in C++ programming, you have to ask to the user to enter the string, now start checking for vowel (i.e., a, A, e, E, i, I, o, O, u, U) to delete all the vowels from the string. If any one found of the 10 (5 lowercase and 5 uppercase) then place the next character after the found to the back until the last and continue to next found, as shown here in the following program.
Source Code: Delete Vowels from String in C++
/* C++ Program - Delete Vowels from String */ #include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> void main() { clrscr(); char str[20]; int len, i, j; cout<<"Enter a 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 will be : "<<str; getch(); }Output
Enter a string : blazingminds After deleting the vowels, the string will be :blzngmds