1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trying to format a program

  1. Jul 2, 2010 #1
    Last edited: Jul 2, 2010
  2. jcsd
  3. Jul 2, 2010 #2

    Filip Larsen

    User Avatar
    Gold Member

    Its a bit hard to see how you intend things to be lined up since your code seems to just prints everything on one line. Perhaps you should include some endl() somewhere? If you are in doubt where, make an example of how you would like the output to be and start figuring out on what "condition" you want a new line.

    Also, if you use setw() to format your output you should note, that it sets the with for the next field being output. You can see a short description on [1].

    [1] http://www.cprogramming.com/tutorial/iomanip.html
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook