9-Arrays - Arrays MIDTERM Monday Oct 17 In class Multiple...

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

View Full Document Right Arrow Icon
Arrays
Background image of page 1

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

View Full DocumentRight Arrow Icon
MIDTERM Monday Oct 17 In class Multiple Choice Short answer program questions Closed book, no computers, OR PHONES Four exam versions
Background image of page 2
Reading Chapter 4, pgs 109 -114
Background image of page 3

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

View Full DocumentRight Arrow Icon
“Lists” of Variables Sometimes, it becomes necessary to order variables in a list: Temperature on April 1 = 90 Temperature on April 2 = 87 Temperature on April 3 = 84 in order to spot trends.
Background image of page 4
Lists of variables All of the variables and values are of the same type – integers, strings, whatever. Their order is important. Their place in the list is important May be shortened as… Temp1 = 90 Temp2 = 87 Temp3 = 84
Background image of page 5

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

View Full DocumentRight Arrow Icon
Track the order as a separate variable Called an “index”: Temp[1] = 90 Temp[2] = 87 Temp[3] = 84 x = 2 Temp[ x ] = ? Name [ index ] = value…. index can change!
Background image of page 6
Arrays A difficult concept at first : int z[5]; Means: z[0], z[1] , z[2], z[3], z[4] are separate integer variables Starts at 0. An array with 5 elements is indexed (or subscripted ) from 0 to 4. in C++: int z[ 5 ];
Background image of page 7

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

View Full DocumentRight Arrow Icon
int x; int z[ 10 ]; for (x = 0; x <= 9; x = x+1) { z[x] = x; } What is the value of z[4]? 4! in fact…
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/03/2011 for the course EAS 230 at SUNY Buffalo.

Page1 / 25

9-Arrays - Arrays MIDTERM Monday Oct 17 In class Multiple...

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

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