# Order of Precedence

Hello, I am in a C++ class and I am having an issue with trying to manually compute a expression within the guidelines of order of precedence. I am mainly having an issue with using the modulus operator on xp's calculator. How do I use the "%" modulus operator on the calculator?

Here is a couple of expressions that I am having problem with:

26-14 % 3 + 1

3 + 16 / 7 % 2

###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi Calv1n,
When ever there is a question of precedence, I recommend you use () to wrap around objects you want associated together.  Most programmers don't keep the complete order of precedence memorized, and even if you did, any one maintaining your code would probably have trouble predicting the out come of your code.

You can try something like the following method:
= (26-14) % (3 + 1);

David Maisonave :-)
Cheers!
Software ArchitectCommented:
modulus has the same precedence as division
Commented:
How do I use the "%" modulus operator on the calculator?
do you mean electronic calculator?
if you want to do 14 % 3 in a calculator.
you can do like this 14 divide by 3 you will get answer like 4.6666667 (let's say a.bbbbbbb)
then you minus whatever is a then you multiply back 3 then you can get the modulus value which is 2.

Is this what you want?

Experts Exchange Solution brought to you by