Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your team is tasked to write a program that operates on a std::string of text (assume there are no line breaks in it) and insert

Your team is tasked to write a program that operates on a std::string of text (assume there are no line breaks in it) and insert linebreaks such that no more than a specified number of characters of text occur per line. You should not split up words across lines, so there maybe less than that specified number of characters of text per line. For instance, if the specified number of characters was 30, the

std::string of text Alice opened the door and found that it led into a small passage, not much larger than a rat-hole: she knelt down and looked along the passage into the loveliest garden you ever saw. would be stored in a new std::string, with the necessary line breaks, as Alice opened the door and found that it led into a small passage, not much larger than a rat-hole: she knelt down and looked along the passage into the loveliest garden you ever saw. and written to standard output accordingly.

-Implement a program in C++ that meets the specifications detailed above. Make sure that you compile frequently on and test diligently.It is recommended that you use stringstream (#include) in your solution; you dont have too though, but Id recommend getting some practice with stringstreams prior to the exam.

Note: provided an output stringstream ostringstream oss you could insert a value to that string using the familiar oss << word notation. Once youve inserted everything necessary to the stream, you can create a string from the stream by writing oss.str().

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_2

Step: 3

blur-text-image_3

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

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions