ch09 - Microsoft Visual Basic 2008: Reloaded Third Edition...

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

View Full Document Right Arrow Icon
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Nine 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
Microsoft Visual Basic 2008: Reloaded, Third Edition 2 Objectives After studying this chapter, you should be able to: Declare and initialize a one-dimensional array Store data in a one-dimensional array Display the contents of a one-dimensional array Code a loop using the For Each…Next statement Access an element in a one-dimensional array Search a one-dimensional array Compute the average of a one-dimensional array’s contents
Background image of page 2
Microsoft Visual Basic 2008: Reloaded, Third Edition 3 Objectives (continued) Find the highest entry in a one-dimensional array Update the contents of a one-dimensional array Sort a one-dimensional array Create and manipulate parallel one-dimensional arrays Create and initialize a two-dimensional array Store data in a two-dimensional array Search a two-dimensional array
Background image of page 3

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 4 Using Arrays Simple variable (or scalar variable ): a variable that is unrelated to any other variable in memory Array : A group of variables with the same name and data type that are related in some way Used to temporarily store related data in memory Increases the efficiency of a program Commonly used arrays: One-dimensional Two-dimensional
Background image of page 4
Microsoft Visual Basic 2008: Reloaded, Third Edition 5 One-Dimensional Arrays One-dimensional array : Can be viewed as a column of variables Subscript : A unique number that identifies each variable in a one-dimensional array Starts at 0 for first element in the array Use array name and subscript to refer to each individual variable in the array
Background image of page 5

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 6 One-Dimensional Arrays (continued) Figure 9-1: Names of the variables in a one-dimensional array named states
Background image of page 6
Microsoft Visual Basic 2008: Reloaded, Third Edition 7 One-Dimensional Arrays (continued) Figure 9-2: How to declare a one-dimensional array
Background image of page 7

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 8 One-Dimensional Arrays (continued) Element : an individual variable in the array When an array is declared: Each element in the array is initialized if no values are provided Initial values can be specified for elements Populating the array : assigning initial values to an array After declaration, can use an assignment statement to store a value in an array element
Background image of page 8
Microsoft Visual Basic 2008: Reloaded, Third Edition 9 One-Dimensional Arrays (continued) Figure 9-3: How to store data in a one-dimensional array
Background image of page 9

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 10 Manipulating One-Dimensional Arrays Array elements can be used like any other variable Examples: Display the contents of an array Access an array element using its subscript Search the array Calculate the average of data stored in a numeric array Find the highest value stored in an array Update array elements Sort array elements
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/05/2010 for the course CIS 2656 taught by Professor Marvpelot during the Winter '08 term at Oakland CC.

Page1 / 54

ch09 - Microsoft Visual Basic 2008: Reloaded Third Edition...

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

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