Академический Документы
Профессиональный Документы
Культура Документы
Treasures application
LESSON A OBJECTIVES
After studying Lesson A, you should be able to:
Declare and initialize a one-dimensional array
Store data in a one-dimensional array
Determine the number of array elements and the
highest subscript
Traverse a one-dimensional array
Code a loop using the For EachNext statement
USING ARRAYS
Array
ONE-DIMENSIONAL ARRAYS
One-dimensional array
Subscript
11
Number is an integer
GetUpperBound method
13
Traversing an array
16
18
19
20
Figure 9-11
Examples of code for the
btnCalc_Click event procedure
(continues)
21
Figure 9-11
Examples of code for the btnCalc_Click event procedure (contd.)
22
23
24
25
26
Figure 9-18 Illustration of the relationship between the list box and array
27
Figure 9-19 Most of the code for the Prairie Auditorium application
28
One-dimensional arrays
29
Sorting
Array.Sort method
Figure 9-26 Syntax and examples of the Array.Sort and Array.Reverse methods
32
33
LESSON A SUMMARY
An array groups variables with same data type
under one name
Individual array variables also called elements
Arrays may be declared with or without list of
initial values
34
35
LESSON B OBJECTIVES
After studying Lesson B, you should be able to:
Explain the relationship between the elements in
parallel one-dimensional arrays
Create parallel one-dimensional arrays
Locate information in two parallel onedimensional arrays
36
Parallel arrays
LESSON B SUMMARY
42
LESSON C OBJECTIVES
After studying Lesson C, you should be able to:
Declare and initialize a two-dimensional array
Store data in a two-dimensional array
Sum the values in a two-dimensional array
Search a two-dimensional array
43
TWO-DIMENSIONAL ARRAYS
Two-dimensional array
Resembles a table
Storing variables (elements) in rows and columns
44
45
Figure 9-38 Syntax versions and examples of declaring a two-dimensional array (continues)
46
Figure 9-38 Syntax versions and examples of declaring a two-dimensional array (contd.)
47
Figure 9-39
Examples of
statements used to
store data in a twodimensional array
(continues)
48
Figure 9-39 Examples of statements used to store data in a two-dimensional array (contd.)
49
51
54
LESSON C SUMMARY
57
58