Set Precision & Underlining Text

This is a discussion on Set Precision & Underlining Text within the C++ Programming forums, part of the General Programming Boards category; Okay I left my C++ book at school and I don't remeber the setprecision code. I just need it for ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    52

    Set Precision & Underlining Text

    Okay I left my C++ book at school and I don't remeber the setprecision code. I just need it for two decimail places. I think its setprecision(2); however I remeber I need to include some other stuff before this.

    Also I forgot the command to under line text when outputing to a txt file. This I have no clue.

    Thanks a million, for your help in advance !

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    I can help with the first question.
    Code:
    cout << setiosflags(ios::fixed) << setprecision(2);
    You've got me on the second question, though.

    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>Also I forgot the command to under line text when outputing to a txt file. This I have no clue.
    A straight text file doesn't support underlining, you'll need a specific file format for that.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    52
    We are just printing to a txt file (ie notepad)

  5. #5
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    don't forget...

    #include <iomanip> class
    // this helps you use the format manipulator setprecision(2)
    Good Luck!
    cj
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Format Precision & Scale
    By mattnewtoc in forum C Programming
    Replies: 1
    Last Post: 09-16-2008, 11:34 AM
  2. how to set text of button1.text to something
    By GUIPenguin in forum C# Programming
    Replies: 1
    Last Post: 07-07-2006, 05:53 PM
  3. Need to set EDIT background BLACK and EDIT text WHITE
    By Garfield in forum Windows Programming
    Replies: 3
    Last Post: 08-29-2003, 02:36 PM
  4. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 05:10 AM
  5. how to set variable of a text box?
    By Jasonymk in forum C++ Programming
    Replies: 1
    Last Post: 02-05-2003, 11:11 AM

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