1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
grandymaker [24]
3 years ago
5

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 vowel, or The rest of the string (beyond the first character) contains a vowel
Computers and Technology
1 answer:
Tpy6a [65]3 years ago
3 0

Answer:

The method definition to this question as follows:

Method definition:

bool containsVowel (string s1) //define method.  

{

bool value=false; //define bool variable and assign value.

//check conditions.

if (s1.length()==0) //if block

{

   return false; //return value

}

else if (s1[0]=='a'||s1[0]=='e'||s1[0]=='u'||s1[0]=='o'||s1[0]=='i'||s1[0]=='A'||s1[0]=='E'||s1[0]=='U'||s1[0]=='O'||s1[0]=='I') //else if block

{

value=true; //return value.

}

else //else block

{

value = containsVowel(s1.substr(1,s1.length()-1));//calculate value  

return value; //return value.

}

}

Explanation:

In the above code, we define a bool method that is "containsVowel" in this method we pass the string variable that is "s1". Inside a method, we define a bool variable that is "value" and conditional statement that checks in the passed value there is a vowel or not.

  • In if block, we check that pass variable value length is equal to 0. if this condition is true it will return a false value.
  • Then we use else if block in this block we check that if value first letter is vowel to check this condition we use OR logical operator. if this condition is true it will change the variable value that is "true".
  • In the else block we use the value variable that uses the function to check that in passed value there is a vowel if this is true it returns its value.

You might be interested in
When driving, your attention is __________.
maks197457 [2]
It is c hope I helped
7 0
3 years ago
Read 2 more answers
Shooting phases in film and video editing​
Sedbober [7]

Answer:

Filmmaking involves a number of complex and discrete stages including an initial story, idea, or commission, through screenwriting, casting, shooting, sound recording and pre-production, editing, and screening the finished product before an audience that may result in a film release and an exhibition.

6 0
3 years ago
Type the correct answer in the box. Spell the word correctly.
aev [14]

Answer:if you are looking for video and audio data its mp4

Explanation:

there is no explaination

8 0
3 years ago
Read 2 more answers
If a user copies the formula D15 into D16, what would the formula read in D16?
ella [17]
=B16*C16 hope that helped
4 0
3 years ago
Read 2 more answers
WILL GIVE BRAINLIEST AND HALLOWEEN CANDY!!!!!!!!!<br> who wants to talk?
Tamiku [17]
<h2>Sure, I wanna talk. (:      .........................</h2>
3 0
3 years ago
Other questions:
  • A technician is tasked to implement a wireless router that will have the fastest data transfer speed at 5 GHz frequency. Which o
    11·1 answer
  • Write a complete C++ program that do following. Read a positive integer from the user with proper prompt. Assume that this user
    9·1 answer
  • The third wave of computing was characterized by the introduction of _____.
    10·1 answer
  • Among the following, which is the best protection against ransomware?
    8·1 answer
  • Which of the following refers to a collection of colors, fonts, and effects that can be
    6·1 answer
  • Users at UC need to be able to quickly create a Resource record from the Project record's Chatter feed How should the App Builde
    10·1 answer
  • Which one of these do you need to become president of the US ?
    6·2 answers
  • A type of SDLC in which each phase has results that flow into the next phase is called the __________ model.
    8·1 answer
  • Chantelle wants to change the color scheme for her company's web app, and she needs to get the logos updated. What kind of devel
    8·1 answer
  • A _______________ is a particular type of network that uses circuits that run over the Internet but that appears to the user to
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!