This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Loops: while, do/while, and for True condition decides how many times the code is repeated; infinite true never ends and will crash the system Loop continues until the expression is false i=1 sum += (i++); sum=sum + i; i = i + 1 while (i < n) { sum = i + sum; i++; } cout for the above statement, if n=5 sum =1, i=2 sum=3, i=3 sum=6, i=4 sum10, i=5 all variables must be initialized tracinggoing through the loop sentinel loop: midterm next Friday (return) becomes MIDTERM NEXT FRIDAY (return) (return is not part of the code in this example) Each letter has a numerical value If ‘a’=36 and ‘m’=100; take the difference and add it to the value of ‘A’ to get ‘M’ Do/while loop Code always done at least once Code done first (not checking expression) Examples on slides, study slides for midterm!...
View
Full
Document
This note was uploaded on 04/08/2008 for the course CSE 123c taught by Professor Elkarboutly during the Spring '08 term at UConn.
 Spring '08
 elkarboutly

Click to edit the document details