Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,304 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,048 people online right now. Registration is fast and FREE... Join Now!




adding spaces into a string being read in

 
Reply to this topicStart new topic

adding spaces into a string being read in

Melissa(plusplus)
post 2 Apr, 2008 - 05:27 AM
Post #1


New D.I.C Head

*
Joined: 2 Apr, 2008
Posts: 1

Basically my teacher gave me a problem in class that we have 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 like this:

"Beware_____the_____Jabberwock,_____my___son!"

i dont need those dashes underline but that is what the spacing is suppose to look like...

i basically know what to do using getline and set precision but i just need to know how to put in that spacing...someone want to start me off???
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 2 Apr, 2008 - 05:29 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,170



Thanked 33 times

Dream Kudos: 25
My Contributions


Are you using character arrays or string objects?
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/22/08 02:05AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month