FormatFloat()

This is a discussion on FormatFloat() within the C++ Programming forums, part of the General Programming Boards category; Anyone know why this isn't working... (my first time trying to use it so i probably using it wrong..) FormatFloat(size_list->Strings[a], ...

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

    FormatFloat()

    Anyone know why this isn't working... (my first time trying to use it so i probably using it wrong..)

    FormatFloat(size_list->Strings[a], 0000)

    shouldn't a number like 54

    be outputed as 5400
    or 0054 instead it just outputs 54


    also

    FormatFloat(size_list->Strings[a], ####.00)

    shouldn't this take 54 and ouput

    54.00

    ?? am i doing something wrong? gives me an error saying # sign not right.. and a number like 5432.34 will turn into 543234 if it runs through the first format function... i'm confused
    Last edited by tegwin; 03-06-2002 at 05:03 PM.

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    11

    Perhaps...

    I've never used that method, I always do this and it works:

    In your printf() or cprintf() or whatever you are using:

    Code:
    printf("blah blah %f.2 blah blah", size_list->Strings[a]);
    Where 2 is the number of digits you want after the .
    If that doesn't work, try %.2f, one of them works for sure.
    C:\DOS\
    C:\DOS\RUN\
    \RUN\DOS\RUN\

Popular pages Recent additions subscribe to a feed

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