SlideShare a Scribd company logo
Introducing One-Dimensional
Arrays
Introducing Two-Dimensional
Arrays
2
Introducing Arrays
• Each array contains data using same variable
name and data type
• Each value or object stored at a position
– Position numbers start at zero
• Zeroth element is first element
– Position also called index or subscript
– Index must be zero, a positive Integer, or an Integer
expression
3
Introducing Arrays
Name of array (note that
all elements of this array
have the same name,
intNetUnitsSold)
Position number (index
or subscript) of the
element within array
intNetUnitsSold
intNetUnitsSold(0)
intNetUnitsSold(1)
intNetUnitsSold(2)
intNetUnitsSold(3)
intNetUnitsSold(4)
intNetUnitsSold(5)
intNetUnitsSold(6)
intNetUnitsSold(7)
intNetUnitsSold(8)
intNetUnitsSold(9)
intNetUnitsSold(10)
intNetUnitsSold(11)
0
10
16
72
154
89
0
62
-3
90
453
178
78intNetUnitsSold(12)
Array consisting of 13 elements
4
Declaring and Allocating Arrays
  Sum Array application’s Form in design view.
5
Declaring and Allocating Arrays
• You must specify the size, name and data type
for an array before using
• Allocating memory for the array
– Use New to create the array
– Initializer list
• Specifies initial values of elements
6
Declaring and Allocating Arrays
  Declaring an array in the event handler.
Creating an
array of
Integers
7
Declaring and Allocating Arrays
• GetUpperBound method
– Returns highest index in the array
• Length property
– Returns the length of the array
8
Declaring and Allocating Arrays
Calculating the sum of the values of an array’s elements.
Retrieve the value of
each element and add
it to the total, one at a
time
9
Declaring and Allocating Arrays
Displaying the sum of the values of an array’s elements.
Introducing Two-Dimensional
Arrays
Two-Dimensional Rectangular
Arrays
• Two-dimensional arrays
– Also called double subscripted
– Requires two indices to identify particular elements
– Often used to arrange tables into rows and columns
– m-by-n array has m rows and n columns
Row 0
Row 1
Column 0 Column 1 Column 2 Column 3
Column index (or
subscript)Row index (or subscript)
Row 2
intA rray(0,0) intA rray(0,1) intA rray(0,2) intA rray(0,3)
intA rray(1,0) intA rray(1,1) intA rray(1,2) intA rray(1,3)
intA rray(2,0) intA rray(2,1) intA rray(2,2) intA rray(2,3)
Array name
Figure 18.4   Two-dimensional rectangular array with three rows and four columns.
Two-Dimensional Rectangular
Arrays
13
Two-Dimensional Rectangular
Arrays
• Array declaration
– Dim intNumbers As Integer(,) = New Integer(1, 1) {}
intNumbers(0, 0) = 1
intNumbers(0, 1) = 2
intNumbers(1, 0) = 3
intNumbers(1, 1) = 4
OR
– Dim intNumbers As Integer(,) =
New Integer(,) {{1, 2}, {3, 4}}
Example
Add all elements in a two-
dimensional array

More Related Content

What's hot

Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
 
Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation
Anil Kumar Prajapati
 
Array
ArrayArray
Array
PRN USM
 
Java arrays
Java arraysJava arrays
Java arrays
Jin Castor
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
topu93
 
2nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 12nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 1
Aahwini Esware gowda
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
Prof. Dr. K. Adisesha
 
Presentation on queue
Presentation on queuePresentation on queue
Presentation on queue
Rojan Pariyar
 
Array
ArrayArray
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
Rohit Rai
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Poojith Chowdhary
 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)
PRABHAHARAN429
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
Arzath Areeff
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
Vivek Kumar Sinha
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
Awais Alam
 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure
Prof Ansari
 
Data structures notes
Data structures notesData structures notes
Data structures notes
Upasana Talukdar
 
Array operations
Array operationsArray operations
Array operations
ZAFAR444
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
Rai University
 
Row major and column major in 2 d
Row major and column major in 2 dRow major and column major in 2 d
Row major and column major in 2 d
nikhilarora2211
 

What's hot (20)

Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation
 
Array
ArrayArray
Array
 
Java arrays
Java arraysJava arrays
Java arrays
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
 
2nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 12nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 1
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
Presentation on queue
Presentation on queuePresentation on queue
Presentation on queue
 
Array
ArrayArray
Array
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure
 
Data structures notes
Data structures notesData structures notes
Data structures notes
 
Array operations
Array operationsArray operations
Array operations
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
 
Row major and column major in 2 d
Row major and column major in 2 dRow major and column major in 2 d
Row major and column major in 2 d
 

Viewers also liked

2 arrays
2   arrays2   arrays
2 arrays
trixiacruz
 
Arrays
ArraysArrays
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
Hattori Sidek
 
Arrays
ArraysArrays
Data structure stack&queue basics
Data structure stack&queue   basicsData structure stack&queue   basics
Data structure stack&queue basics
Selvin Josy Bai Somu
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
eShikshak
 
Array ppt
Array pptArray ppt
Array ppt
Kaushal Mehta
 
Linked List data structure
Linked List data structureLinked List data structure
Linked List data structure
Marcus Biel
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
Amrinder Arora
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Ehtisham Ali
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
Amrinder Arora
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Nikhil Sharma
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
Tech_MX
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
 
Stack
StackStack
Array in C
Array in CArray in C
Array in C
Kamal Acharya
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
Arvind Devaraj
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
Aakash deep Singhal
 

Viewers also liked (20)

2 arrays
2   arrays2   arrays
2 arrays
 
Arrays
ArraysArrays
Arrays
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
 
Arrays
ArraysArrays
Arrays
 
Data structure stack&queue basics
Data structure stack&queue   basicsData structure stack&queue   basics
Data structure stack&queue basics
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
 
Array ppt
Array pptArray ppt
Array ppt
 
Linked List data structure
Linked List data structureLinked List data structure
Linked List data structure
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
Stack
StackStack
Stack
 
Array in C
Array in CArray in C
Array in C
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 

Similar to Lecture7

Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
Koteswari Kasireddy
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
HEMAHEMS5
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
arrays.pptx
arrays.pptxarrays.pptx
arrays.pptx
HarmanShergill5
 
Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...
nsitlokeshjain
 
Array.pdf
Array.pdfArray.pdf
Array.pdf
DEEPAK948083
 
Arrays
ArraysArrays
Arrays
sana younas
 
arrayppt.pptx
arrayppt.pptxarrayppt.pptx
arrayppt.pptx
shivas379526
 
Arrays
ArraysArrays
2D Array
2D Array 2D Array
2D Array
Ehatsham Riaz
 
Arrays
ArraysArrays
cluod.pdf
cluod.pdfcluod.pdf
cluod.pdf
ssuser92d367
 
DSA Unit II array.pptx
DSA Unit II array.pptxDSA Unit II array.pptx
DSA Unit II array.pptx
sayalishivarkar1
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
researchgrad82
 
Lecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdfLecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdf
MianSaeedAkbar1
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
Arrays
ArraysArrays
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
MamataAnilgod
 
2D-Arrays
2D-Arrays2D-Arrays
2D-Arrays
Sampad Kar
 
2D arrays
2D arrays2D arrays

Similar to Lecture7 (20)

Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
arrays.pptx
arrays.pptxarrays.pptx
arrays.pptx
 
Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...Basic of array and data structure, data structure basics, array, address calc...
Basic of array and data structure, data structure basics, array, address calc...
 
Array.pdf
Array.pdfArray.pdf
Array.pdf
 
Arrays
ArraysArrays
Arrays
 
arrayppt.pptx
arrayppt.pptxarrayppt.pptx
arrayppt.pptx
 
Arrays
ArraysArrays
Arrays
 
2D Array
2D Array 2D Array
2D Array
 
Arrays
ArraysArrays
Arrays
 
cluod.pdf
cluod.pdfcluod.pdf
cluod.pdf
 
DSA Unit II array.pptx
DSA Unit II array.pptxDSA Unit II array.pptx
DSA Unit II array.pptx
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
 
Lecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdfLecture 2.8 Arrays.pdf
Lecture 2.8 Arrays.pdf
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
 
Arrays
ArraysArrays
Arrays
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
 
2D-Arrays
2D-Arrays2D-Arrays
2D-Arrays
 
2D arrays
2D arrays2D arrays
2D arrays
 

Recently uploaded

People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
gaafergoudaay7aga
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
TaghreedAltamimi
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 

Recently uploaded (20)

People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 

Lecture7

  • 2. 2 Introducing Arrays • Each array contains data using same variable name and data type • Each value or object stored at a position – Position numbers start at zero • Zeroth element is first element – Position also called index or subscript – Index must be zero, a positive Integer, or an Integer expression
  • 3. 3 Introducing Arrays Name of array (note that all elements of this array have the same name, intNetUnitsSold) Position number (index or subscript) of the element within array intNetUnitsSold intNetUnitsSold(0) intNetUnitsSold(1) intNetUnitsSold(2) intNetUnitsSold(3) intNetUnitsSold(4) intNetUnitsSold(5) intNetUnitsSold(6) intNetUnitsSold(7) intNetUnitsSold(8) intNetUnitsSold(9) intNetUnitsSold(10) intNetUnitsSold(11) 0 10 16 72 154 89 0 62 -3 90 453 178 78intNetUnitsSold(12) Array consisting of 13 elements
  • 4. 4 Declaring and Allocating Arrays   Sum Array application’s Form in design view.
  • 5. 5 Declaring and Allocating Arrays • You must specify the size, name and data type for an array before using • Allocating memory for the array – Use New to create the array – Initializer list • Specifies initial values of elements
  • 6. 6 Declaring and Allocating Arrays   Declaring an array in the event handler. Creating an array of Integers
  • 7. 7 Declaring and Allocating Arrays • GetUpperBound method – Returns highest index in the array • Length property – Returns the length of the array
  • 8. 8 Declaring and Allocating Arrays Calculating the sum of the values of an array’s elements. Retrieve the value of each element and add it to the total, one at a time
  • 9. 9 Declaring and Allocating Arrays Displaying the sum of the values of an array’s elements.
  • 11. Two-Dimensional Rectangular Arrays • Two-dimensional arrays – Also called double subscripted – Requires two indices to identify particular elements – Often used to arrange tables into rows and columns – m-by-n array has m rows and n columns
  • 12. Row 0 Row 1 Column 0 Column 1 Column 2 Column 3 Column index (or subscript)Row index (or subscript) Row 2 intA rray(0,0) intA rray(0,1) intA rray(0,2) intA rray(0,3) intA rray(1,0) intA rray(1,1) intA rray(1,2) intA rray(1,3) intA rray(2,0) intA rray(2,1) intA rray(2,2) intA rray(2,3) Array name Figure 18.4   Two-dimensional rectangular array with three rows and four columns. Two-Dimensional Rectangular Arrays
  • 13. 13 Two-Dimensional Rectangular Arrays • Array declaration – Dim intNumbers As Integer(,) = New Integer(1, 1) {} intNumbers(0, 0) = 1 intNumbers(0, 1) = 2 intNumbers(1, 0) = 3 intNumbers(1, 1) = 4 OR – Dim intNumbers As Integer(,) = New Integer(,) {{1, 2}, {3, 4}}
  • 14. Example Add all elements in a two- dimensional array