Question

This is a discussion on Question within the C++ Programming forums, part of the General Programming Boards category; Code: cout << setiosflags( ios::fixed | ios::showpoint ) << "The total retail value was: " << setprecision( 2 ) << ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    9

    Question

    Code:
       cout << setiosflags( ios::fixed | ios::showpoint )
            << "The total retail value was: " << setprecision( 2 )
            << total << endl;
    my question is what would the

    setiosflags( ios::fixed | ios::showpoint )

    thing do to my variable called total? a friend told me to use it for money, but didnt have time to explain what it means anyone?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Wouldn't it be easier just to put that code into a simple program and actually try it?
    I can't imagine that would take more than a couple of minutes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    9
    I did it, and I know the output, but I need to know what setiosflags means and the ios:: before the fixed and what ios::showpoint means, I am new to C++

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    120
    setiosflags is a function that sets the global flags that control the Input/Output Stream flags. ios is a name space for input/output stream.

    A google search could tell you about what the various flags mean and what they do. There are a ton of stream I/O articles, docs and guides online.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Here's a link to a good reference:

    Try looking on your compiler's documentation/help for setiosflags. If that doesn't help, try doing a search at Dinkumware.com. (Click-on the footprints to get-to the free reference.) Dinkumware is the most complete C++ reference that I've found. ...But, I'm not saying that it's the easiest reference to understand.

    In order to understand how the the flags actually work, you need to understand binary numbers, bit-weights (1, 2, 4, 8, 16...) and bitwise operations.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

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