Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

NEED WITHIN ONE HOUR OF POSTING!!!!- WILL RATE Write a C++ program that implements the following: The function count_vowels() that accepts a string as its

NEED WITHIN ONE HOUR OF POSTING!!!!- WILL RATE

Write a C++ program that implements the following:

The function count_vowels() that accepts a string as its argument. The function should count the number of vowels appearing in the string and return that number.

The function count_consonants() that accepts a string as its argument. This function should count the number of consonants appearing in the string and return that number.

Demonstrate the two functions in a main program that performs the following steps:

The user is asked to enter a string.

The program displays the following menu:

Letters count program

A) Count the number of vowels in the string

B) Count the number of consonants in the string

C) Count both the vowels and consonants in the string

D) Enter another string

E) Exit the program

The program performs the operation selected by the user and repeats until the user selects E, to exit the program.

Your output should look like the following:

Enter a string: Hello! my name is Jane.??What is your name?

A) Count the vowels in the string

B) Count the consonants in the string

C) Count both vowels and consonants

D) Enter another string

E) Exit this program

C

The string has 13 vowels and 18 consonants.

A) Count the vowels in the string

B) Count the consonants in the string

C) Count both vowels and consonants

D) Enter another string

E) Exit this program

q

Enter A, B, C, D, or E.

A

The string has 13 vowels.

A) Count the vowels in the string

B) Count the consonants in the string

C) Count both vowels and consonants

D) Enter another string

E) Exit this program

b

The string has 18 consonants.

A) Count the vowels in the string

B) Count the consonants in the string

C) Count both vowels and consonants

D) Enter another string

E) Exit this program

e

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions