A community for students. Sign up today!
Here's the question you clicked on:
← 55 members online
 0 viewing
 one year 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.
 one year 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

slotema
 one year ago
Best ResponseYou've already chosen the best response.0A 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.
Ask your own question
Ask a QuestionFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.