Thread: floating point function

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> It will return a the value you enter but will not put the decimal in the right spot.
    Ok, good. So the problem is likely with the dflag and/or dplace variable. When I look at that part of the code, I see that this:
    Code:
              if (dflag==1)
                {
                  dplace*=10;
                }
              pos++;
    is never actually called. It is not under a case statement. Where did you mean for that code to be run?

  2. #17
    Registered User
    Join Date
    Apr 2007
    Posts
    26
    I would like to thank you for all your help.
    It has been the most help anyone has giving on this
    thanks so much
    Sal

  3. #18
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by Sal79 View Post
    I am tring to make a function to check to make sure the floating piont value is a valid number. i am having some problem getting it to work correctly.
    any help would be great.
    Is this an academic exercise, or can you use standard functions that already do this (and much more thoroughly)?
    http://www.daniweb.com/code/printsnippet597.html
    http://www.parashift.com/c++-faq-lit....html#faq-39.2
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. floating point number comparison
    By lehe in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2009, 07:11 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM