Lecture09 - Project 1 and Review for Exam Introduction to...

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

View Full Document Right Arrow Icon
1 Project 1 and Review for Exam Introduction to Arrays Review for Exam Reading for this Lecture: Section 7.1-7.2 Practice exam is on-line on my website
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Introduction to Arrays It is very useful to have a group of variables that can be processed in a loop where one variable is processed during each pass through the loop But we don’t want to declare them as individual variables, e.g. five individual integer variables: int book0; book1, book2, book3, book4; We can’t use a loop index variable to refer to one variable book0, book1, etc without a lot of nested if-else statements or a switch statement
Background image of page 2
3 Introduction to Arrays Without arrays we would need to do something like this (NOTE: Don’t do it this way!): int book0, book1, book2, book3, book4; for (int i = 0; i < 5; i++) { switch (i) { case 0: statements using book0; break; case 1: same statements using book1; break; // three more cases needed here } }
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/25/2010 for the course CS 110 taught by Professor Wilson during the Spring '10 term at University of Massachusetts Boston.

Page1 / 10

Lecture09 - Project 1 and Review for Exam Introduction to...

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

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