Question
For C++ please design, write the code and create the requisite submission files for the following problem: Functional Requirements: A menu-driven program that offers the
For C++ please design, write the code and create the requisite submission files for the following problem:
Functional Requirements:
A menu-driven program that offers the user a grid of characters and then 5 options to change the grid as follows:
Menu:
1. Interchange column 1 with column 4
2. Display the total number of vowels
3. Display the array in a matrix (rows and columns)
4. Search for and display number of instances of any given character
5. Exit
Programming Requirements:
In main(), declare and initialize a 2-dimensional array of characters that contains 5 x 5 elements. Initialize the elements to:
s w e e t
h e a r t
e g r i t
c l one
o d o r s
Display the menu and then execute the user's choice. Keep displaying the menu (and executing the user's choice) until the user chooses Option 5. (See pseudocode in this lesson for design help.)
Programming Notes:
In menu option 1, swap the actual array values. Don't display the array. That's a different menu option.
In menu option 2, display the total number of vowels.
In menu option 3, display the array as a matrix (ie, rows and columns). Leave spaces between each character. Use the iomanip library to help you create a nice display.
In menu option 4, prompt the user for one character. Search the array and count the number of times it occurs. Display the results.
In menu option 5, say goodbye and exit the program.
Execute the chosen menu option by passing the array to a specific function which will do the work (in other words, there will be 4 array processing functions and one exit function).
No global variables, although global constants are fine. Remember, you must pass the array to the functions and not do the work in main().
Validate for bad menu item. (You can use the "default" option of the switch statement to handle that.)
Make sure to use a character array and not an array of strings. Treat each char as an individual element.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started