Write a function called recCountVowels() that accepts a pointer to a string and
ID: 3658229 • Letter: W
Question
Write a function called recCountVowels() that accepts a pointer to a string and any other arguments you see fit, and recursively (make sure its recursive) counts the number of vowels in the provided string. This function should return the number of vowels in the string. Ill make sure to top rate anyone who can do this!
Explanation / Answer
/*you have to include (iostream.h) &(string.h)*/ int recCountVowels(char *str) { int count=0; if(strlen(str)>=1) { if(str[0]=='a' || str[0]=='A' || str[0]=='e' || str[0]=='E' || str[0]=='i' || str[0]=='I' || str[0]=='o' || str[0]=='O' || str[0]=='u' || str[0]=='U') { count=recCountVowels(++str)+1; } else { count=recCountVowels(++str); } } return count; }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.