Given a string sfr, write a program to eliminate all the vowels from it. The lis
ID: 3564834 • Letter: G
Question
Given a string sfr, write a program to eliminate all the vowels from it. The list of vowels in the English alphabet is : {a,e,i,o,u,A,E,I,O,U} The input to the function eliminateVowelstring shall consist of a string str (containing only English letters), and returns a pointer to a string which does not contain vowels. Example: Input =abcdefghijklmnopqrstuvwxyz Output=bcdfghjklmpqrstvwxyz Useful Commands: st,! en? is used to calculate the length of the string. The statement - inf len = strlen (str); returns the length of the string sfr.Explanation / Answer
#include #include int check_vowel(char); int main() { char s[100], t[100]; int i, j = 0; printf("Enter a string to delete vowels "); gets(s); for(i = 0; s[i] != ''; i++) { if(check_vowel(s[i]) == 0) { //not a vowel t[j] = s[i]; j++; } } t[j] = ''; strcpy(s, t); //We are changing initial string printf("String after deleting vowels: %s ", s); return 0; } int check_vowel(char c) { switch(c) { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U': return 1; default: return 0; } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.