Get 2 days of unlimited access
Class Notes (1,000,000)
US (420,000)
U of M (7,000)
EECS (8)
Arthur (1)
Lecture 7

EECS 183 Lecture Notes - Lecture 7: Increment And Decrement Operators

Elec Engin & Computer Sci
Course Code
EECS 183

This preview shows half of the first page. to view the full 3 pages of the document.
Project 2 is out and due next Friday
Exam 1 is on October 10th
Boolean Operators
Expressions are going to be true or false
(a == b) a is equal to b
(a != b) a is not equal to b
(a > b) a is greater than
(a < b) a is less than
<= less than or equal to
>= greater than or equal to
Combine multiple boolean expressions
(a && b) true if both a and b are true
(a || b) true if at least one of a and b is true
(!a) not a
Conditions will always be evaluated as true or false
(1 < 2 < 3) is evaluated as ((1 < 2) < 3) → (1< 3) → 1
Need to break it down into individual sets of true and false
(3 > 2 > 1) evaluates as ((3 > 2) > 1) → (1 > 1) will end up false, you get wrong answer
Moral of the story: one operator at a time!
Truth and Style
Bool isEven;
Cin >> isEven;
If (isEven) {
If (!isEven) {
This is the same as saying (isEven == true); or (isEven == false)
Also could use an else statement
Else is associated with the most recent if statement in the scope
No such thing as if if else
COMMON ERROR: make sure not to mix up between using the = and == when doing
conditionals. The = will assign whatever value you want to be equated to
You're Reading a Preview

Unlock to view full version