Question
The purpose of the second program is to continue refining our programming skills in C++ and practice using arrays of characters, the subscript operator, the
The purpose of the second program is to continue refining our programming skills in C++ and practice using arrays of characters, the subscript operator, the cstring library, and functions with arguments. Our goal is to create programs with a small functions where main delegates to a series of functions where the real work takes place. In this programming assignment, you are not allowed to use global variables. Avoid using break from an if or loop (unless working with a switch statement). Limit your functions to no more than 30 statements of code (not including comments, blank lines, or variable definitions). Remember to never use a return in the middle of a loop! The idea with this assignment is to write your own functions to solve this problem. Program Assignment: Have you noticed when you use some editors or word processors, it automatically formats your document as you type. For example, with word if you are doing a bulleted list and hit return it will automatically place your cursor at the right location to begin typing. For program #2, we will implement a simplified version of an editor that will allow the user to enter in a few paragraphs of text and based on that it will display it formatted in a easy to read format. It will follow these rules: 1. The first word of each paragraph will be automatically indented by a tab 2. Two spaces will always occur after every period, exclamation mark, or question mark regardless of what the user types in 3. The first letter of the paragraph will be capitalized 4. The first letter of each sentence will be capitalized 5. At the end make sure to display the number of characters and words in the text. Allow the user to enter in a text ending with a # sign to complete the entire process. A sentence is to be no more than 130 characters and a paragraph no more than 300 characters. *** THE ALGORITHM IS CRITICAL! Think about how to read in the text, how to detect the end of a sentence and how to detect the first word of a paragraph. CS162 Winter 2020 Program #2 Things you should know...as part of your program: 1. It is expected that you will read the paragraph into an array of characters! Learning how to process arrays is one of the major goals of this assignment. You should become fluent with the subscript operator in this assignment. We recommend using the 3 argument version of cin.get 2. After each input operation, make sure to use cin.ignore to remove the delimiters! 3. Make sure to prompt the user for any input requested. Make sure it is clear from your prompts what the user is expected to do. 4. Use the cstring library with strlen to know when to stop processing the array of characters. strlen should not be in the conditional expression. Consider using it prior to a loop and storing the results of strlen in a variable!! 5. Use the subscript operator [] to match letters, using a loop (recommend for loops) 6. You may not use any global variables in this program! But, you may use global constants! 7. You may not use the string class instead use arrays of characters with cstrings 8. Make sure to use C++s I/O (iostream library) for your input and output. 9. FUNCTIONS are required for this assignment
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