Decimal function

This is a discussion on Decimal function within the C++ Programming forums, part of the General Programming Boards category; I need a function that allows a positive number with a decimal point, to be rounded up or down. For ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    17

    Decimal function

    I need a function that allows a positive number with a decimal point, to be rounded up or down. For example:

    2.3 would be 2
    2.7 would be 3



    I also need a function that, when a user inputs 4 numbers, that the numbers are only allowed if they are positive. I have figured out how to have the user input 4 numbers but can't figure how to assure that they are positive and when they're aren't, an error message informs the user.

    Any help would be appreciated
    Thanks

  2. #2
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    just check the mantissa and reassign the number appropriately...
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 10:03 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM

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