Thread: Setprecision and setiosflags in C++

  1. #1
    Registered User
    Join Date
    Nov 2020
    Posts
    8

    Setprecision and setiosflags in C++

    In the example that i took from the deitels C book there is a statement in the code which is shown in below can you explain what does this codes means
    thank you
    Code:
    using std::setprecision;
    using std::setiosflags;
    
    cout << setiosflags(ios::fixed | ios::showpoint);
    cout << setprecision(1);

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,161
    Yes, but it would be somewhat easier if you made use of existing material that explains them: cppreference.com entry list on Input/output manipulators
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble displaying records using setiosflags and linked list
    By darksifer in forum C++ Programming
    Replies: 5
    Last Post: 05-11-2011, 08:57 AM
  2. setiosflags dont work
    By sporkit in forum C++ Programming
    Replies: 2
    Last Post: 04-26-2006, 10:49 PM
  3. setw(), setiosflags(), etc
    By ForlornOdium in forum C++ Programming
    Replies: 1
    Last Post: 12-08-2003, 08:55 AM
  4. cout << setiosflags(256L) << 123.123;
    By jochen123 in forum C++ Programming
    Replies: 2
    Last Post: 11-20-2002, 11:17 AM
  5. setiosflags(ios::fixed)
    By Invincible in forum C++ Programming
    Replies: 1
    Last Post: 02-10-2002, 04:22 AM

Tags for this Thread