EECS 183 Lecture Notes - Lecture 9: Infinite Loop, Data Validation, While Loop

103 views4 pages
EECS 183 Full Course Notes
1
EECS 183 Full Course Notes
Verified Note
1 document

Document Summary

Variable += expression is same as variable = variable + (expression) Ex: x += 5; is same as x = x + 5; When used in expressions cout << i++; cout << ++i; Loops cout << i; i = i+1 i = i + 1; cout << i; Loop is a block of code that is executed more than once in a row. Keeps executing as long as condition is true. Body of loop must change the condition so that it"s eventually false. If a semicolon after the condition, it"s an empty statement loop body. Used for executing block of code a specific number of times. Better to use for loop if you know how many times the loop would iterate. Used for executing a block of code until specified condition is false. Use while for event controlled where you don"t know how many times the loop will iterate often times when user enters input.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents