Tom Kelliher, CS 116
Sept. 25, 2002
Collect lab write-ups.
Read over Soda Pop lab.
Finished up Lab 4.
if
statement.
Lab 5.
int
(for integers) or
either float
or double
(for reals).
+
, -
, *
, /
.
var = expression;
var += increment;Similarly for
-=
, *=
, and /=
.
<
, >
, ==
, !=
, >=
, and <=
.
For example, the operator ==
returns true
if the
values are equal and false
otherwise. The operator !=
returns true
if the values are not equal and false
otherwise.
if (<boolean expression>) statement;or
if (<boolean expression>) statement; else statement;The boolean expression evaluates to either
true
or false
.
The following statement is executed only if the expression is true
.
The expression after the else
is only executed if the boolean
expression is false.
Refer to handout.