CS 106A Lecture 5: CS 106A Lecture Notes Week 2 Wed

68 views2 pages

Document Summary

Interactive programs: reads input from the console. The program pauses, waiting for the user to type a value. The value typed by the user is stored in a variable: readint(), readdouble(), readline(), and readboolean(, requires user input in order to continue program. Revisiting if/else: executes one group if a test is true, another if false, to test the if/else statement, we use relational operators. >= greater than or equal to: to create several possibilities of if statements, use if/ else if/ else statements. You can also end with an else if statement, which makes the program do nothing if none of the statements are true: logical operators. Precedence: arithmetic (addition, multiplication, etc. ) relational (less than equal, etc. ) Revisiting for loops: for (initialization; test; update) { statements, perform initialization once, repeat the following: Revisiting while: repeatedly executes its body as long as a logical test is true, sentinel loops. Sentinel: a value that signals the end of user input.

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