lecture3slides

lecture3slides - Mondays Topics 1. 2. 3. 4. 5. 6. 7....

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Monday’s Topics 1. Project #2 questions 2. Finish up Wednesday’s Slides 3. Top-down, Stepwise Refinement 4. Some new operators 5. The for loop 6. The do-while loop 7. Nested loops We’re moving pretty fast now, so it is important to read the book before class if this material is new for you! Wednesday: 1. The switch statement 2. Loops-continued: break and continue 3. Nested loops 4. Type-casting 5. The character and its many forms 6. Print formatting 7. Logical operators && and ||
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Top-down, Stepwise Refinement It’s easy: 1. State the overall goal of your program. 2. Divide ( refine ) this goal into a series of smaller tasks and list these in the order they need to be performed. 3. As long as any task can be further refined, do so. Grade averaging example: TOP: Calculate the average for an exam REFINED: 1. Initialize all variables 2. Input the data from the user and sum this data up. 3. Calculate and print the class average. FURTHER REFINED: 2.A. Input a score from the user 2.B. If the user types –1, stop 2.C. Add score into the total score 2.D. Add 1 to the count of scores 2.E. Go back to step 2.A etc…
Background image of page 2
New Operators +=, -=, *=, /= main() { int a = 0, b = 5; a = a + 5; // old syntax a += 5; // new syntax // also a *= 10; // a = a * 10; a /= b; // a = a / b; a -= a; // a = a – a; a %= 13; }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Pre and Post-increment Operators main() { int a = 0;
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/08/2011 for the course CS 31 taught by Professor Melkanoff during the Fall '00 term at UCLA.

Page1 / 16

lecture3slides - Mondays Topics 1. 2. 3. 4. 5. 6. 7....

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online