ECS 30 Chapter Notes - Chapter 3: Decision-Making, Logical Connective, Unary Operation

60 views3 pages

Document Summary

Decision making in a program is focused on choosing to execute one set of program statements over another set. Comparing things in c involve relational operators, or operators that compare the values. The comparison results in a boolean type, either a 0 or 1, or false and true. A common mistake involving the equality comparison is type one = when in reality it needs to have two ==. To set up a statement to make decisions, you use the simple if statement, which uses the keyword if. e. g. if (comparison) The if statement does not require a ; on the relational comparison, but after the action it is supposed to do. This action is most often written on a new line for the sake of clarity. If statements allow you to be selective about what type input you will get, for example, if you receive a number outside a desired range you can change it with an if statement check.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents