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]
2 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]2 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
If you are going to develop a special computer, what would it be and explain it's purpose.​
Ann [662]

Answer:

It would be to figure out what cancers someone could exactly so no need for a biopsy

4 0
3 years ago
On a leading-trailing system technician A says that both shoes do equal work when stopping while going in reverse. Technician B
sleet_krkn [62]

Based on the scenario above about the leading-trailing system Both technician A and B are incorrect.

<h3>How many brake shoes function?</h3>

There are known to be two shoes function that are said to be working a way where both become either the trailing shoe or leading shoe based on whether the vehicle is moving forward or backward.

Therefore we can say that, Based on the scenario above about the leading-trailing system Both technician A and B are incorrect.

Learn more about trailing system from

brainly.com/question/14367881

#SPJ1

5 0
1 year ago
What is the key to satisfaction and success when choosing a career
ELEN [110]

Answer:

be yourself

Explanation:

3 0
3 years ago
Read 2 more answers
Research: "How was your experience on site '4chan'?"<br><br> Please answer in the box below.
olganol [36]

Answer:

My experience was comfortable

Explanation:

This website is pretty simple and loads fast, there are a lot of images with high quality but only when you click over of the image this expands in the original size.

I could find really helpful information, there are different subjects, but this is not a website for kids for some adult content.

I didn't need to register any information to share content or if you want to ask something and everything is anonymous.

5 0
3 years ago
For some reason i cant see brainly answers
denis23 [38]

Answer:

Same thing happening to me and several other people. At this point I wonder if there site is having troubles. I tried to email them but even that is not working.

Explanation:.

4 0
2 years ago
Other questions:
  • Is bit stuffing necessary in the control or address field in theHDLC protocol? why?
    13·1 answer
  • A firewall, when properly implemented, can prevent most attacks on your system.
    11·1 answer
  • Describe one type of technology that is useful in producing images from space.
    9·1 answer
  • When excel imports an access table, the data is placed in a worksheet _____?
    7·1 answer
  • Explain why a document created by word processing software is stored as a binary file.​
    14·1 answer
  • 1.Discuss why this class is important (or not) to a soon-to-be security practitioner. 2.Discuss one of more subjects you have le
    7·1 answer
  • What is the name of the process of checking the client's production environment to ensure software and hardware compatibility wi
    5·2 answers
  • Add me on Fortn!te <br> TsarBacon (imma girl)
    11·1 answer
  • The use of technology to observe a user's actions often without the user's knowledge is known as:
    11·1 answer
  • What is the function of tab?<br>​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!