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
Spreadshet formula to add totals​
frozen [14]

Answer:

=SUM(Range value)

like =SUM(A1:A7) or =SUM(A1:H1)

Explanation:

We need to make use of the SUM function, and then we need to mention the cells or range value that references a series of cells row-wise or column-wise. Like a range value of A1:A7 means A1,A2,A3,A4,A5,A6,A7 and the range value of A1:H1 means A1, B1,C1,D1,E1,F1,G1,H1. And similarly, you can represent various cells depending upon the code you come up it, and finally, you need to sum them all using the SUM function.

7 0
3 years ago
When programming, the word "execute" means which of these?
Inga [223]

Answer:

to run!

Explanation:

hope this is helpful!

7 0
3 years ago
Which one of the following items is an example of software?
Harlamova29_29 [7]
Word processing program is an example of a software. All the others, such as Printer, Keyboard and Mouse are examples of Computer peripheral devices or in short hardware devices. Generally these listed hardware devices come under input or output computer device category. Also, by classic meaning in layman terms these hardware components can be touched or felt. In contrast, a word processing program is a part of a computer system that consists of data or computing instructions and provides the mechanism to computer to perform a certain task utilizing it's hardware resources. Such components of computer system which are written using one of the computer languages are called computer software or software programs or simply software.
4 0
3 years ago
Along with an ip address, a subnet mask, and a name server, the other thing required for a computer to operate on a network is a
laiz [17]

Along with an IP address, a subnet mask, and a name server, the other thing required for a computer to operate on a network is a primary gateway. The primary gateway acts as an access point which forwards information to another network or the internet.

6 0
3 years ago
Which factor did not contribute to the increase of leisure travel in the early twentieth century in the United States?
Vitek1552 [10]
The second factor as it did not make travel easy at all
6 0
3 years ago
Read 2 more answers
Other questions:
  • The material chosen for your study group
    11·1 answer
  • Tom Daniels, an employee of a telecommunications company, is developing software that would enable customers to activate value-a
    7·1 answer
  • Your sister asks you if it is possible to get an office productivity suite for free. What do you tell her?
    13·1 answer
  • What are Important points to include about preventing the download of malware?
    14·1 answer
  • As a prospective student, what is the best reason to request an interview with your college application?
    6·1 answer
  • Match the elements of a web page with their descriptions.
    12·1 answer
  • What is the difference between MySQL and MariaDB?
    9·1 answer
  • Direction: Write True on the line if the statement is correct. Write False if the statement is incorrect. 1. All objects are com
    13·2 answers
  • What can handle work that is hard on a person and could cause repetitive injuries?
    6·1 answer
  • Drag each tile to the correct box.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!