the problem is as follows my teacher wants me to:
write a program that reads lines of text into a string using the getline(cin,line) function and then type sets these lines of text so that they are column aligned on the left and right margins as shown in the second example above.

So it looks like this:

"Beware____the____Jabberwock,____my___son! without the underscores just wanted to put those in so you know what i mean by the spaces.

HELP ME PLEASE!! ive been working on it for liek 3 days i cannot get it for the life of me!!!

Recommended Answers

All 3 Replies

Define column lengths, determine the length of each word (think string), pad the word with spaces to reach appropriate column width and then display padded strings OR use output modifiers/manipulators like setw() or setwidth() or printf() format modifiers, etc.

thats my question though what would a code to set spaces be???

We're not going to do your homework for you. You need to show us what you did and we can help you fix it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.