Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following functions. Each of these functions should have a single parameter -- accepting a c-style string as an argument. The function should

Write the following functions. Each of these functions should have a single parameter -- accepting a c-style

Write the following functions. Each of these functions should have a single parameter -- accepting a c-style string as an argument. The function should only do what is specified (note that none of these functions do any output to the screen). Your functions should use const in the prototype wherever it is appropriate: 1. Write a function that counts and returns the number of vowels in the string. (For the purposes of this exercise, we are talking about the standard 5 vowels -- A, E, I, O, U). 2. Write a function that counts and returns the number of consonants in the string. 3. Write a function that converts the string to all lowercase. 4. Write a function that converts the string to all uppercase. Menu program Write a main program that performs the following steps: 1. Prompt the user to enter a string, and let them type it in. This could be an entire sentence, with the newline indicating the end of the string. You may assume the string will be no more than 100 characters, so declare your array accordingly. 2. Display the following menu: 3. A) B) 5. (C) Count the number of vowels in the string Count the number of consonants in the string Convert the string to uppercase Convert the string to lowercase Display the current string 6. D) 7. (E) 8. (F) Enter another string 9. M) Display this menu 10. X) Exit the program 3. Enter a loop, allowing the user to type in a menu choice each time. Loop should continue until the user enters the command to exit. Upper and lowercase letters should be allowed for the menu choices. a. When the A or B commands are entered (counting vowels or consonants), call the corresponding function, then print the result b. When the C or D commands are chosen, just call the appropriate function to convert the string. Do not do any output from main on these commands. c. When E is chosen, print the contents of the stored string. d. When F is chosen, allow a new string to be typed -- this will replace the previous one. e. The menu should only be displayed once at the start, and then again whenever the M option is selected

Step by Step Solution

3.43 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Computer Network questions

Question

Write a for statement to compute the sum 1 + 2 + 3 + 4 + 5 + + n .

Answered: 1 week ago

Question

22. Why is tPA not helpful in cases of hemorrhagepg105

Answered: 1 week ago