I'm new with C++ and im having troubles with logical operators, my textbook doesnt explain it well so this might be completely wrong, although here are a few questions i had to do with my solutions.
Using parentheses, rewrite the following expression to indicate the correct order of evaluation. Then evaluate the expression, values r a=5, b=2, and c=4.
a % b * c && c % b * a
((5% 2) * 4) && ((4 % 2) * 5)
1 * 4 && 0 * 5
4 && 0
since there both false the operation is false.
Determine the value of the expression, a=5, b=2, c=4, and d=5.
d % b * c > 5 || c % b * d < 7
((5 % 2) *4) > 5 ||((4 % 2) * 5) < 7
( 1 * 4) > 5||(0 * 5) < 7
4 > 5 || 0 < 7
0 || 1
alrite, since 1 statement is true and the other false, the operation is true.
Using parentheses, rewrite the expression to indicate the correct order of evaluation. evaluate the expression, a=5, b=2, and c=4.
b % c * a || a % c * b
((2 % 4) * 5) || ((5 % 4) * 2)
0 * 5 || 1 * 2
0 || 2