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
Once you have selected the range of cells for your table data, from which tab can you open the Insert Table dialog box?
Anuta_ua [19.1K]

A. Insert Tab. Specifically, The insert tab, then click "Table" which will open the Insert Table Dialog Box. Good luck!

3 0
4 years ago
Read 2 more answers
Which guideline should you use when downloading software from the internet?
Anton [14]
Limiting your computer's vulnerability to malware is a crucial safe browsing habit. You can protect your computer by running antivirus<span> and </span>antimalware<span> software like </span>Bitdefender<span>, </span>Norton<span>, or </span>Kaspersky<span>. These programs can block malware from being installed and can remove it if it does get onto your computer. Even if you don't see signs of malware on your computer, running regular scans can catch any malware that has escaped notice.</span>
4 0
3 years ago
Read 2 more answers
Select the correct answer.
zmey [24]

Answer: data design model

Explanation:

8 0
3 years ago
Which domain indicates that a website is sponsored by a university or college?
d1i1m1o1n [39]

There are two domains that are commonly associated with sites that owned by a university or college: .edu and .ac.

In the case of .edu, <u>it is only available for United States higher education institutions or higher education institutions outside U.S that are affiliated with the United States since 2001.</u>

For non-U.S colleges and universities, they will commonly <u>use .ac as a second-level domain before putting in their country domain as the top-level domain.</u> Examples of this would be .ac.uk and .ac.jp.  


8 0
3 years ago
You are responsible for performing all routine maintenance on your company's laser printers. Which of the following maintenance
Luden [163]

Answer:

B. installing the maintenance kit

Explanation:

page count keeps track of how many number of pages that have been printed since the installation of the last maintenance kit. When a new maintenance kit is installed on most Laser printers, the page count is reset because it does not automatically clears most times, hence, there's the need to clear the count manually.

4 0
4 years ago
Other questions:
  • Let's say you want to insert a photo of the Microsoft PowerPoint Ribbon to put into your presentation. Which of these should you
    6·1 answer
  • You are looking for a backup that copies only the files that have changes since the last full backup. Which of the following wil
    13·1 answer
  • A manufacturer wishes to design a hard disk with a capacity of 30 GB or more (using the standard definition of 1 GB = 2^30 bytes
    7·1 answer
  • Which of the following ways is NOT one of the ways that the census is
    5·1 answer
  • 14. Which of the following statements is true? A. The most secure email message authenticity and confidentiality isprovided by s
    11·1 answer
  • What is the difference between Input, Output, and Storage Devices?
    12·2 answers
  • Which device do engineers use to drive a system of gears?
    15·2 answers
  • Write a MIPS assembly language program that adds the following two integers and displays the sum and the difference. In the .dat
    10·1 answer
  • You’ve been given a new cell phone with a 2 gigabyte data plan. You plan to use your phone for text messages, images, video, and
    13·1 answer
  • How have the computers contributed in the banking ?<br>​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!