Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write this small program with C++ using arrays of characters, the subscript operator, the cstring library, and functions with arguments. Please dont use global

Please write this small program with C++ using arrays of characters, the subscript operator, the cstring library, and functions with arguments. Please don"t 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. Please never use a return in the middle of a loop!

Program

Please code 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, fallowing 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.

Please 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.

Program notes;

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. Please use the subscript operator. 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 program.

Thank you.

Step by Step Solution

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

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

Students also viewed these Databases questions