Thread: help with alignment

  1. #1
    Registered User
    Join Date
    Feb 2002

    Unhappy help with alignment

    I need some help getting three different cout lines to align.
    the first two lines are:
    sum average product
    ----- ---------- ---------
    and the third line is were the variables go. My program runs and the variables work, but I can't get the white space to line up...

    any suggestions?


  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Use <iomanip>

    cout << setw(10) << "test" << endl << setw(7) << 10 << endl;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alignment tutorial needed!!
    By mynickmynick in forum C++ Programming
    Replies: 11
    Last Post: 09-12-2008, 04:41 AM
  2. Dynamic struct alignment?
    By matthew180 in forum C Programming
    Replies: 7
    Last Post: 06-15-2007, 08:34 AM
  3. memory boundry alignment with stuctures
    By ed bitwise in forum C Programming
    Replies: 3
    Last Post: 05-08-2006, 11:33 AM
  4. Ok, I'm dumb, byte alignment for the third time
    By Shadow12345 in forum C++ Programming
    Replies: 2
    Last Post: 12-30-2002, 06:19 PM
  5. trouble with printf alignment
    By hyaline in forum C Programming
    Replies: 5
    Last Post: 09-22-2001, 01:39 AM