Hey all I have a quick question how would a computer read this process.

If a = 52, b = 13, c = 4, and float e = 2.71828

A) a / d % b * c

B)a % c == b

C)!(b + d != c * c)

D) d % b * > 5 || c % b * d > 7

E) (((a +1)*b + 2) & c + 3) / d +e

I put the first formula in the compiler and it gave me 40 but by hand I get different results. Please explain how a computer would read this thank you.

If a = 52, b = 13, c = 4, and float e = 2.71828

A) a / d % b * c

B)a % c == b

C)!(b + d != c * c)

D) d % b * > 5 || c % b * d > 7

E) (((a +1)*b + 2) & c + 3) / d +e

I put the first formula in the compiler and it gave me 40 but by hand I get different results. Please explain how a computer would read this thank you.

You need to consult a C++ operator precedence table:

http://en.cppreference.com/w/cpp/language/operator_precedence

Another table can also be found here, if you scroll down:

http://cplusplus.com/doc/tutorial/operators/

http://en.cppreference.com/w/cpp/language/operator_precedence

Another table can also be found here, if you scroll down:

http://cplusplus.com/doc/tutorial/operators/

Last edited on

Topic archived. No new replies allowed.