Thread: Explaination

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    3

    Explaination

    Can someone throw some light on this line of code ...

    setiosflag (ios::fixed | ios::showpoint)

    and

    setprecision(4)

  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    It is used for decimal notation (like in floats).

    It says to use a fixed decimal (instead of scientific notation), to use the decimal point, and to have a precision (numbers after decimal point) of 4 decimals.

    Used for output formatting.
    Blue

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    3
    so i assume that it is not necessary to have it included.
    But should i want to use setprecision(*), do i have to include the setiosflag(io::fixed | ios::showpoint.

  4. #4
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    you should
    Blue

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    203
    ios::showpoint will show the decimal on all floats & doubles

    without showpoint set, 4.00 may display as 4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. explaination of code
    By gtr_s15 in forum C++ Programming
    Replies: 7
    Last Post: 02-02-2006, 02:25 AM
  2. explaination coding for my viva!!! urgent!!!
    By SweeLeen in forum C++ Programming
    Replies: 1
    Last Post: 10-17-2005, 05:35 AM
  3. Need explaination of the following function
    By dianazheng in forum C Programming
    Replies: 5
    Last Post: 06-09-2005, 10:34 AM
  4. Explaination of behavior in C
    By Mister C in forum C Programming
    Replies: 14
    Last Post: 08-15-2004, 05:57 PM
  5. emotiona post: recap, improvisational explaination of the irrational.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-01-2002, 09:04 AM