Question: C++ Please implement a function that accepts a string parameter as well as a boolean parameter and returns a boolean. Your function should return true.
C++ Please implement a function that accepts a string parameter as well as a boolean parameter and returns a boolean. Your function should return true. when the number of 'Z' matches the number of vowel characters (A, E, I, O, U and Y) found in the string. Otherwise, return false. If all six of the vowel characters are found once or more in the string parameter, set the boolean argument to true. Otherwise, set the boolean argument to false. The declaration for this function will be:
bool vowelCountMatchesZs( string s, bool & foundAllVowels );
Here are some examples of how a main routine could test this function:
bool b = false;
assert( vowelCountMatchesZs( "", b ) == true ); // zero Zs and zero vowels assert( b == false ); // not all vowel characters found in the string
assert( vowelCountMatchesZs( "ZZ AEIOUY 12345", b ) == false ); // two Zs and six vowels assert( b == true ); // all vowel characters found in the string
assert( vowelCountMatchesZs( " ZZ AE 12345 ghqw", b ) == true ); // two Zs and two vowels assert( b == false ); // not all vowel characters found in the string
Write your vowelCountMatchesZs function in the text box below. You do not have to write a main routine or #include directives.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
