# Thread: c ++ MODULUS OPERATOR

1. ## c ++ MODULUS OPERATOR

what do I do now!

2. the modulus operator gives you the remainder, such as 15%6=3

6 goes into 15 2 times and 3 is left over

3. bless you.

4. Are you wondering about the workings of a modulus operator in general, or something specific to c++? In general, a modulus operator works like this:

Divides the value of one expression by the value of another, and returns the remainder.

result = number1 % number2

where % is the modulus operator.

For example,

20 % 8 would return a value of 4

5. Originally posted by Markel
Are you wondering about the workings of a modulus operator in general, or something specific to c++? In general, a modulus operator works like this:

Divides the value of one expression by the value of another, and returns the remainder.

result = number1 % number2

where % is the modulus operator.

For example,

20 % 8 would return a value of 4
wow dude i beat you by 4 minutes

and no prob oblongmelon

6. Thanks guys I appreciate it..(and so does Becca)

7. Originally posted by Burzhui

wow dude i beat you by 4 minutes
I got distracted while I was typing my response.

But I think mine was better.

8. Originally posted by Markel

I got distracted while I was typing my response.

But I think mine was better.
dude you kidding right, mine was right and straight to the point

9. Originally posted by Burzhui

dude you kidding right, mine was right and straight to the point
Ever try to code:
15%6=varname

That's one reason why I think my answer was better.

10. Originally posted by Markel

Ever try to code:
15%6=varname

That's one reason why I think my answer was better.
you mean varname = 15 % 6;

I gave it in words and an example... boo ya grandma

11. Originally posted by Burzhui

you mean varname = 15 %6;
Look at your first response, and tell me what order you put it in!

12. that was theory man

in mathematics 15%6=3

in programming

int result;
result = 0;
result = 15 % 6;

return result;

13. Originally posted by Burzhui
that was theory man
Clarity is what it's all about, man. That's why I gave a CLEAR explanation.

wanna duel???

15. I won.

16. Originally posted by Markel

I won.
you missed plus in a ny case i'm a porn making and here you go and to finish you off

17. Originally posted by Burzhui
you missed plus in a ny case i'm a porn making and here you go and to finish you off
That's lame. Just admit it - I'm better.

18. Originally posted by Markel

That's lame. Just admit it - I'm better.
uhhh Cha

i answered first and it was good and understandable... but your input is obviously valuable as well, so shake on it, and move on.

19. Ok. You can go back to your "weekend interests".

20. Haha. this useless exchange was pretty funny to read.

21. Originally posted by BrewMaster
Haha. this useless exchange was pretty funny to read.
Well, I was going to let this thread drop off the bottom, but as long as you "woke it up", I'll add one more thing. There was a reason that I "pressed" this issue. It is true that Burzhui's answer was adequate to meet the need. However, as an answer to a programming language question, it was weak as compared to what followed. I have been writing software for 30 years now, and believe me, I have learned the value of code that is carefully planned out AND DOCUMENTED as compared to something that is just slammed together and happens to work. The first takes a little longer up front, but in the end it usually saves time, and in the long run (for maintainability) it is infinitely better.

So, if you are in pursuit of a career dealing with software development, take a lesson from someone who's been there.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•