Question: Write a program that reads a sequence of words and then prints them in a box, with each word centered, like this: +----------+ | Hello

Write a program that reads a sequence of words and then printsWrite a program that reads a sequence of words and then prints them in a box, with each word centered, like this:

+----------+
| Hello |
| C++ |
|programmer|
+----------+

I know I can break the program down into 2 parts which is finding the max word length to assure the centering for any of the following words and then just ensuring the printing is correct. Scalability is important since the user can input any string. I am suppose to be able to do it using loops along with if else statements.

Write a program that reads a sequence of words and then prints them in a box, with each word centered, like this: Hello programmer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!