CSCI 1105 Lecture 6: CSCI 1105 Lecture 5 - Decisions & Relational Operations

117 views2 pages
Verified Note

Document Summary

Apply what you learn to checking user input. Compare integers, floating point numbers, and strings. A computer program needs to make decisions based on input, or circumstances: allows a program to carry out different actions depending on the nature of the data to be processed. For example, buildings often skip the 13th floor, and elevators should too: the 14th floor is the 13th floor, so, every floor above (cid:1005)(cid:1006) is really (cid:858)floor (cid:1005)(cid:859) If floor > 12, actual floor = floor 1: the two keywords of the if statement are if, else. One of the two branches is executed: true (if) branch, false (else) branch. A statement might not even need an else branch. The if statement is an example of a compound statement. Compound statements span multiple lines and consist of a header and a statement block. Compound statements require a colon at the end of the header.

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