29.9k views
20 votes
write a recursive bool valued function containsvowel that accepts a string and returns true if the string contains a vowel

User Pakii
by
5.1k points

1 Answer

1 vote

Answer:

Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A string contains a vowel if: The first character of the string is a v…

Step-by-step explanation:

A:

bool containsVowel (string s) { bool hasVowel=false; if (s.length()==0) return false; else if (s[0]=='a'|| s[0]=='e'|| s[0]=='u'|| s[0]=='o'|| s[0]=='i'|| s[0]=='A'|| s[0]=='E'|| s[0]=='U'|| s[0]=='O'|| s[0]=='

User Breana
by
5.3k points