left align, 12 places

This is a discussion on left align, 12 places within the C++ Programming forums, part of the General Programming Boards category; Code: int val; cin >> val; // what do i do here so that val takes 12 places and is ...

  1. #1
    Banned
    Join Date
    Nov 2007
    Posts
    678

    left align, 12 places

    Code:
    int val;
    cin >> val;
    // what do i do here so that val takes 12 places and is left aligned?
    cout << val;

  2. #2
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Code:
    #include <iomanip>
    
    // . . .
    
    cout << left << setw(12) << val;

  3. #3
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I wonder if there is more than one person using this account?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  4. #4
    Banned
    Join Date
    Nov 2007
    Posts
    678
    anon, thanks for a BIG lol!!

    in other thread i tried to delete it, but could not found the delete option, so i replied to my own post, just to ridicule myself.

    in this thread i asked this question, when i was really frustrated, even after looking at cpp reference, i could not find how to do this, so i posted the question here, but after some time, with a little luck, i got the answer, i posted here, just in case . . . *_*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Decimal places
    By Gordon in forum Windows Programming
    Replies: 9
    Last Post: 06-08-2008, 09:04 AM
  2. multiple values in #define(?) & counter placement
    By bnmwad in forum C Programming
    Replies: 2
    Last Post: 04-30-2006, 06:00 AM
  3. working out
    By ZakkWylde969 in forum A Brief History of Cprogramming.com
    Replies: 35
    Last Post: 11-29-2003, 12:17 PM
  4. Heaps...
    By Nutshell in forum C Programming
    Replies: 14
    Last Post: 04-23-2002, 08:54 AM
  5. Can't figure out why?
    By kwigibo in forum C Programming
    Replies: 10
    Last Post: 10-14-2001, 10:58 PM

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