Thread: set() alignment

  1. #1
    Unregistered
    Guest

    Question set() alignment

    anyone out there let me know what the script is to align an output to the right: setw(4)setiosflags(left) ect.. i know this is wrong.. looking for the right script.. thanks

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    #include<iostream>
    #include<iomanip>
    using namespace std;
    int main()
    {
    int a =100,b=200;
    cout<<setw(4)<<right<<a<<setw(4)<<left<<b<<flush;
    return 0;
    }
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Unregistered
    Guest

    Thumbs up reply

    thanks stoned.. worked sweet

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    This code doesn't work for me, is this compiler dependant or standard?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 01-13-2008, 02:14 AM
  2. Replies: 7
    Last Post: 08-19-2007, 08:10 AM
  3. The new FAQ
    By Hammer in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 08-30-2006, 10:05 AM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM
  5. Set default directory with GetTempDir?
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 05-04-2003, 11:36 PM