CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Unhappy What means cout.precision (4)?

    Hi, everyone!

    What means cout.precision (4)? Who can give me
    a sample to show the usage?


    Thanks in advance,
    George

  2. #2
    Join Date
    Nov 2002
    Location
    Sofia, Bulgaria
    Posts
    661
    it sets the precision of floating point numbers same as the "%.4f" formatter

    example

    cout.pecision(4);
    cout << 445.26382011334;

    will output
    445.2638
    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames

  3. #3
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Talking

    Thanks, SeventhStar buddies!

    George

    Originally posted by SeventhStar
    it sets the precision of floating point numbers same as the "%.4f" formatter

    example

    cout.pecision(4);
    cout << 445.26382011334;

    will output
    445.2638

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