ENGR 101 Lecture 14: Iteration in C++

123 views2 pages
31 Mar 2015
School
Department
Course

Document Summary

Engr 101: introduction to computers and programming - lecture 14: iteration in c++ Used to decide between a number of cases. Switch (integer_expression){ case value: expression case value: expression default: expression. The integer expression is evaluated and the thread of execution starts from the matching case. If none matches it it starts with the default. Can check the status of a command or action. Iteration can be accomplished with a while statement in the form, while (condition) loop_body. The condition evaluates to true or false. The loop body is an expression or compound statement in {braces} If the condition is true the loop body executes, then the condition is checked again. The loop body is repeatedly executed as long as the condition holds. Can also cause the early termination of a selection statement or a loop. Example: for(n = 5; n

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