help with alignment

This is a discussion on help with alignment within the C++ Programming forums, part of the General Programming Boards category; I need some help getting three different cout lines to align. the first two lines are: sum average product ----- ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    5

    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?

    Thanks,
    Bigb1999

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

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

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, 05:41 AM
  2. Dynamic struct alignment?
    By matthew180 in forum C Programming
    Replies: 7
    Last Post: 06-15-2007, 09:34 AM
  3. memory boundry alignment with stuctures
    By ed bitwise in forum C Programming
    Replies: 3
    Last Post: 05-08-2006, 12:33 PM
  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, 02:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21