Task
Translate the following natural language expressions to C++
expressions. Assume that all the variables are non-negative integers or boolean (of value true
or false
).
For this task you need to write the solutions in the solutions.cpp
file, by filling the various functions that have been defined for each subtasks.
Example: a
is greater than 3
and smaller than 5
. \Longrightarrow
Solution:
return a > 3 && a < 5;
Note: Do not confuse the bitwise logical operators (e.g., &
) with their binary logical counterparts (&&
). The semantics are slightly different — bitwise operators do not exhibit short circuit evaluation.
a
greater thanb
and the difference betweena
andb
is smaller than15
.a
is an even natural number greater thana
.a
is at most5
times greater thanb
(but can also be smaller thanb
) and at least5
times greater thanc
.- Either
a
andb
are both false orc
is true, but not both. a
is false andb
is zero.
Input
The program expects the task number as the first input followed by the parameters to the chosen task. For example, 3 5 1 1
selects task 3
with a = 5
, b = 1
, and c = 1
.
Note that boolean parameters for tasks 4 and 5 are entered as true and false. For example 4 true false true
would run task 4
with a = true
, b = false
, and c = true
.