Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do you write this code in c++? Project Overview: This project takes a stream of text (strings) and formats the text into a set

How do you write this code in c++?
image text in transcribed
Project Overview: This project takes a stream of text (strings) and formats the text into a set of lines with a specific width. However, rather than just do the standard left-justified text that you see in this the approach used by Leonardo Di Vinci and generate a "mirror" output of the text. That is, we print the text from right-to-left rather than left-to-right. The program prompts the user for the length of an output linc. The program then uses this as the width of all ourput lines. We right justify each line, as this is a true mirror of a standard left paragraph, we take justified paragraph. We cannot do a true mirror of the text, as we do not have the ability to change the direction of our letters. We cannot generate s instead of e (and so on). So we will just print the text out backwards. As an example, consider the input: The quick brown fox jumps over the lazy old dog This text, written backwards, is .god dlo yzal aht revo spmuj xof nworb kciug ehT Two sample executions of the program are shown below. The bottom row (black numbers) is added to show you there are that many columns, you do not have to generate that line of numbers as part of your output. Note that all lines are right-justified. a.out Enter the output line length: 10 Enter your text (control-d to exit) Enter your text (control-d to exit) The quick brown fox jumps over the The quick brown fox jumps over the lazy old dog. a. out Enter the output line length: 25 lazy old dog kciuq ehT xof nworb revo spmuj spmuj xof nworb keiug ehr god dlo yzal eht revo yzal eht go 1234567890 1234567890123456789012345 Two quick comments on this program First, you will never have a case where a single word (string of text) in the input is longer than the size of output line specified by the user. .Second, the longest output line that a user can specify is 100 characters in length. The smallest outpu that can be specified is 10 characters in length. What You Need To Do .Create a directory project3 on your machine. In that directory, create a file named mirror.c . In mirror.c, write the code needed to implement this program. Make sure that you: o o o Include a header block of comments with your name and a brief overview of the program. Prompt the user for the width of your output line. Read the user's text (a set of strings) from standard input until the end-of-file, printing the "mirrored" words in lines of width characters When you are ready to submit your project, bundle your project3 directory into a single (compre zip file. See the Basics document on Blackboard if you do not remember how to do this. Once you have a compressed zip file that contains your project3 code, submit that file to Blackb . per e te projects are not accepteo

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions