Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
← 55 members online
 0 viewing
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
 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
 one year ago

This Question is Closed

slotemaBest ResponseYou've already chosen the best response.0
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.
 one year ago
See more questions >>>
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.