|
-
August 30th, 2017, 11:50 PM
#5
Re: Review, divide two integers
 Originally Posted by TheJollyRoger
Thanks. Now I've fixed that issue.
Note that there's a distinction between integer types and floating point types in C++. Make sure you fully understand this distinction and the implications.
Regarding integer division. This,
Code:
int rest = x / y; // / gives quotient
will give you the quotient (not the rest) of x divided by y. This,
Code:
int rest = x % y; // % gives remainder
will give you the remainder (the rest) of x divided by y. if it is 0 then x is evenly divisible by y. That's what you should use in isFactor().
Last edited by wolle; August 31st, 2017 at 12:04 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|