Asked by Triple_A_Math
                I need to write a function that can determine if each word in a given string contains a vowel. If each word contains a vowel, the function shall return true, if not, the function shall return false. 
My prefered language is C++, but if you want to explain in a similar language (C, Java, C#, ...), that's fine too! Just please don't do Python.
i.e., "hello there man" ---> TRUE, "hello there mrn" ---> FALSE
Thanks in advance to anyone willing to help :)
            
        My prefered language is C++, but if you want to explain in a similar language (C, Java, C#, ...), that's fine too! Just please don't do Python.
i.e., "hello there man" ---> TRUE, "hello there mrn" ---> FALSE
Thanks in advance to anyone willing to help :)
Answers
                    Answered by
            oobleck
            
    in perl, check each word for a vowel. Exit with false if any word is without a vowel.
sub $has_vowel {
$tf = 1;
foreach $word (split " ",$line) {
next if $word =~ /[aeiou]/;
$tf = 0;
last;
}
return $tf;
}
    
sub $has_vowel {
$tf = 1;
foreach $word (split " ",$line) {
next if $word =~ /[aeiou]/;
$tf = 0;
last;
}
return $tf;
}
                    Answered by
            oobleck
            
    not quite. The call would be
has_vowel("check this strng fr vwels")
sub has_vowel {
$tf = 1;
foreach $word (split) {
next if $word =~ /[aeiou]/;
$tf = 0;
last;
}
return $tf;
}
    
has_vowel("check this strng fr vwels")
sub has_vowel {
$tf = 1;
foreach $word (split) {
next if $word =~ /[aeiou]/;
$tf = 0;
last;
}
return $tf;
}
                                                    There are no AI answers yet. The ability to request AI answers is coming soon!
                                            
                Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.