CSE 100 Lecture Notes - Lecture 8: While Loop, Text File, For Loop

30 views3 pages

Document Summary

Cse 100 lecture seven notes - while, do while, for loops, text file i/o. Statements may be a single line or a block. While (a<20) { cout << value of a: << a << endl; a++; Checks the conditional statement at the bottom of the loop. Similar to a while loop, however do while loops are guaranteed to execute at least one time. Conditional statement will appear at the end of the loops. Do{ cout << value of a: << a << endl; a = a + 1; while ( a < 20 ); Allows programmer to construct a loop that will execute a specific number of times. Will only execute if conditional statement is proven true. Using relational operators is highly recommended due to the need to have a terminating statement. Example: for( int a = 10; a < 20; a = a+1 ) { cout << value of a: << a << endl;

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