CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: ostream

  1. #1
    Join Date
    May 1999
    Posts
    1

    ostream

    In C, if I want, for example, to print a variable as a floating point, at least 6 wide and 2 after decimal point, I use : printf("%6.2f", var);
    How can I have the same effect on C++, using cout << ?


  2. #2
    Join Date
    Apr 1999
    Posts
    49

    Re: ostream

    Hi,

    you have to use

    cout << fixed(2) << var;

    to display only 2 number after the decimal point

    Marc


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured