Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

nphuongsun93

  • 3 years ago

C++. How do I check if there is a ' . ' in my data type long? for example: rational (0.9), I want to know if it's a decimal so I can convert it to a fraction.

  • This Question is Closed
  1. slotema
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    A long variable cannot contain a fractional part, it is a long integer, which can only contain whole numbers. If you mean a float or double, you could use the modf function (see: http://www.cplusplus.com/reference/cmath/modf/ ) to split the number into an integer and fractional part.

  2. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy