Boolean Algebra
In ordinary algebra, we study variables that take on any real value. We study the behavior ofthese variables as they interact using the ordinary operations of arithmetic, namely addition,
subtraction, multiplication and division. In Boolean algebra, the variables can have only two
values, true or false. Further, the operations are no longer those of arithmetic, but rather
those of symbolic logic and are called conjunction, disjunction and negation.
In RobotC, we can declare a pair of Boolean variables as
bool p,q;
and we can assign values to them as
p=false; q=true;
In much the same way that we can combine integer- and
oat-type variables using the ordi-
nary arithmetic operations, we can combine boolean-type variables with Boolean operations.
The Boolean operations are de ned as follows.
No comments:
Post a Comment