Question
In this assignment you will write a C++ function called parse that reads one line of user input from the keyboard and creates an array
In this assignment you will write a C++ function called parse that reads one line of user input from the keyboard and creates an array of the strings found in the input. Your function should be passed the array and a reference variable that is to be assigned the length of the array. Prompt the user and read the input from within the function.
For example: If the user inputs cp this that, the resulting array would have length 3 and contain the strings cp, this, and that.
Create a main function that has a loop that will continuously call the function until the user enters the string quit. After the parse function has returned control to main, print the contents of the array and its length.
Your program should:
Give detailed directions to the user.
Contain carefully worded pre and post conditions for the parse function.
Be readable with appropriate documentation and formatting.
Use an array of cstrings.
Read the users input one character at a time using cin.get().
You will need to build the strings one character at time using white space to separate the strings. (Remember that cstrings end in \0.)
DO NOT USE getline() !!!
Skip any extra whitespace within the users input or at the end of the input
copy this that and copy this that would produce the same result.
Turn in an electronic copy of the source (.cpp)
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