Arrays. Lesson Objectives  To understand what an array is and it’s function  To know how code and array in VB.

Slides:



Advertisements
Similar presentations
Ch. 3 Variables VB.Net Programming. Data Types Boolean – True or False values Short – Small integers (+/- 32,767) Integer – Medium-size integers (+/-
Advertisements

Introduction to Arrays Chapter What is an array? An array is an ordered collection that stores many elements of the same type within one variable.
Modeling using VBA. Covered materials -Userforms -Controls -Module -Procedures & Functions -Variables -Scope.
7 – Arrays Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Arrays Storing Multiple Values. Motels l If you have a room in a motel and they give you room 5, which room is it?
VBA Modules, Functions, Variables, and Constants
Arrays Array of Controls: several controls, of the same type (Class: a prototype for an object indicating the properties and methods), that have the same.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 11P. 1Winter Quarter Arrays Lecture 11.
1 Arrays  Arrays are objects that help us organize large amounts of information  Chapter 8 focuses on: array declaration and use passing arrays and array.
PHYS 2020 Making Choices; Arrays. Arrays  An array is very much like a matrix.  In the C language, an array is a collection of variables, all of the.
Chapter 7: Working with Arrays
7.1 Arrays Introduction to arrays Any array is a collection of objects or primitives Useful when the number of reference variables is large or.
Manipulating Strings.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
VB DATATYPES, VARIABLES, CONSTANTS & CALCULATIONS.
Java Unit 9: Arrays Declaring and Processing Arrays.
© 2011 Pearson Education, publishing as Addison-Wesley 1 Arrays  Arrays are objects that help us organize large amounts of information  Chapter 6 focuses.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Processing Arrays Lesson 8 McManusCOP Overview One-Dimensional Arrays –Entering Data into an Array –Printing an Array –Accumulating the elements.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
CPS120: Introduction to Computer Science Arrays. Arrays: A Definition A list of variables accessed using a single identifier May be of any data type Can.
Introduction to Programming Workshop 2 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Variables "There are 10 kinds of people in the world today – those who understand binary and those who don't!” Unknown.
VB Arrays Chapter 8 Dr. John P. Abraham Professor UTPA.
Arrays and 2D Arrays.  A Variable Array stores a set of variables that each have the same name and are all of the same type.  Member/Element – variable.
19/10/20151 Data Structures Arrays. 219/10/2015 Learning Objectives Explain initialising arrays and reading data into arrays. Design and write routine/s.
2D-Arrays Quratulain. Learning Objectives Two-dimensional arrays Declaration Initialization Applications.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
CSC 162 Visual Basic I Programming. Array Parameters and Sorting Array Parameters –Entire Arrays –Individual Elements Sorting –Bubble Sort.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
Advanced Work with Embedded and Summative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
CPS120: Introduction to Computer Science Lecture 15 Arrays.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Arrays, Timers, and More 8.
Arrays.
Other Variable Types Dim lab as String makes a box that can store a label tag Dim ColHead As String ColHead = “function” ColHead function Dim lab as Boolean.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley More About Array Processing 8.2 There Are Many Uses of Arrays and Many Programming.
Arrays and others. Annoucement Today’s office hour move to Friday 1:00PM to 3:00PM Today’s office hour move to Friday 1:00PM to 3:00PM Today Today  Call.
1 Arrays and Strings Lecture: Design Problem l Consider a program to calculate class average Why?? ?
BBC Microbit Getting set up and making your first program.
Arrays Chapter 8. Overview u General discussion u Variable arrays u Control arrays u Multi-dimensional variable arrays  Two-dimensional  Three-dimensional.
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
Processing Arrays Lesson 9 McManusCOP Overview One-Dimensional Arrays –Entering Data into an Array –Printing an Array –Accumulating the elements.
Chapter 8 P 1 Arrays and Grids Single-dimension arrays Definition An array is a sequence of elements all referred to with a common name. Other terms: table,
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 11P. 1Winter Quarter Arrays Lecture 11.
Arrays. Topics to be Covered... Arrays ◦ Declaration ◦ Assigning values ◦ Array manipulation using loops Multi-dimensional arrays ◦ 2D arrays ◦ Declaration.
Multidimensional Arrays Computer and Programming.
Overview of Previous Lesson(s) Over View VP is the methodology in which development allows the user to grab and use the desired tools like menus, buttons,
Multidimensional Arrays tMyn1 Multidimensional Arrays It is possible to declare arrays that require two or more separate index values to access an element.
C++ Array 1. C++ provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used.
MULTI-DIMENSIONAL ARRAYS 1. Multi-dimensional Arrays The types of arrays discussed so far are all linear arrays. That is, they all dealt with a single.
B065: PROGRAMMING Variables 2. Starter  What is wrong with the following piece of code: Option Explicit Off Dim num1 as string Dim num2 as integer num1.
Arrays. Arrays are objects that help us organize large amounts of information.
Aims: To learn about some simple sorting algorithms. To develop understanding of the importance of efficient algorithms. Objectives: All:Understand how.
Objective of the lesson Use Blockly to make a dice for Snakes and Ladders All of you will: – Make an image which displays when you press a button Most.
Introduction to Python Lesson 2a Print and Types.
PROGRAMMING ARRAYS.
Two-Dimensional Arrays
Programming constructs
Chapter 8 Arrays Objectives
Use proper case (ie Caps for the beginnings of words)
Chapter 8 Arrays Objectives
Data Structures – 1D Lists
Chapter 8 Arrays Objectives
B065: PROGRAMMING Variables 1.
To understand what arrays are and how to use them
B065: PROGRAMMING Variables 2.
Just Basic Lessons Mr. Kalmes.
Presentation transcript:

Arrays

Lesson Objectives  To understand what an array is and it’s function  To know how code and array in VB

The Basics So we know what a variable is and how it can store one piece of information at one time, bit like a box You can insert something into the box. ‘name’ You can find out whats in the box by referencing The Problem The downside to this is that you have to declare lots of variable if you want to store lots of information

To the rescue There’s a way to get round this, and that’s arrays An array in its simplest form is a variable that has lots of slots in which you can store information, a bit like pigeonholes So the whole thing is an array with the slots being areas in which you can use

How does it work in VB So just like variables you have to declare the array and also specify the type of the array Dim myArray(10) As String Assigning to the array myArray(0) = ‘Hello’ Referencing the array myVar = myArray(0) Don’t forget that the indexes start at o (zero) This means that if you set up an array with 5 slots the first one is accessed using myArray(0) The number of slots you need

Multidimensional Arrays There are times in which it would be useful to sort more information, for example storing information about a set of people Single-Dimensional Array 0, 01, 02, 03, 04, 05, 06, 0 0, 11, 12, 13, 14, 15, 16, 1 0, 21, 22, 23, 24, 25, 26, 2 0, 31, 32, 33, 34, 35, 36, 3 0, 41, 42, 43, 44, 45, 46, 4 Multi-Dimensional Array First Dimension

Multidimensional Arrays Dim myArray(3, 2) As Integer Assigning to the array myArray(0, 1) = 132 Referencing the array myVar = myArray(0, 0) The same principles apply to a multidimensional array as they do to a single-dimension array TomJamesPeteJohn

Challenges Bronze Challenge - Copy this program, to create and display a list of names. Each name should be printed to a new line. Silver Challenge - Create a multi-dimensional array to store the name and star sign of a group of students. Display a details for a random person when the program is run. Gold Challenge - Use a multi-dimensional array to store names & scores for these Strictly Come Dancing results.