Don’t Leave Home Without them

Slides:



Advertisements
Similar presentations
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.
Advertisements

An Array A sequence of elements of a particular type Each element in the array has an index which gives its position in the sequence An array is declared.
VBA for MS Excel Hamze Msheik. Open the Visual Basic Editor in Excel 2007 Click on the Microsoft Office button in the top left of the Excel window and.
BACS 287 Programming Fundamentals 4. BACS 287 Programming Fundamentals This lecture introduces the following iteration control structure topics: – Do.
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.
Wednesday, 11/6/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 11/6/02  QUESTIONS?? – HW # 4 due Monday  Today:  Return HW #3  Arrays (Chap. 10)  Reading:
Visual Basic Games: Prepare for Hangman
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.
© 2012 EMC Publishing, LLC Slide 1 Chapter 8 Arrays  Can store many of the same type of data together.  Allows a collection of related values to be stored.
# 1# 1 Searching andSorting What is selection sort? What is bubble sort? What is binary search? CS 105 Spring 2010.
Arrays Chapter 8. Chapter 8 - Part 12 Variable and Variable Array Variable Stores only one value Variable Array Variable that has 1 symbolic name but.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Arrays, Timers, and More 8.
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 Adapted from materials created by Dr. Donald Bell, Cal Poly 2000 (updated February 2004)
For…Next and Do...While Loops! Happy St. Patrick’s Day!
Controlling Program Flow with Looping Structures
COMPUTER PROGRAMMING 2 ArrayLists. Objective/Essential Standard Essential Standard 3.00Apply Advanced Properties of Arrays Essential Indicator 3.02 Apply.
Chapter 6 Controlling Program Flow with Looping Structures.
CS 105 – Fall CS105 Lab 10 – Arrays Announcements MP 2: Please make sure you have changed the “Author” field according to your NetIDs Please READ.
Arrays 1.
Welcome to Computer Programming II! Computer Programming II Summer 2015.
BIG DATA Initiative SMART SubstationBig Data Solution.
Arrays and Collections
Introduction toData structures and Algorithms
Sections 10.1 – 10.4 Introduction to Arrays
Review Array Array Elements Accessing array elements
4. Java language basics: Function
2008/11/19: Lecture 18 CMSC 104, Section 0101 John Y. Park
Microsoft Visual Basic 2005: Reloaded Second Edition
Fundamentals of Java: AP Computer Science Essentials, 4th Edition
Foundations of Programming: Arrays
Lists in Python Parallel lists.
2. Understanding VB Variables
ARRAYS.
Arrays & Functions Lesson xx
What is an Array? Why Arrays? Programming Examples.
Visual Basic .NET BASICS
CSCI 3327 Visual Basic Chapter 7: Arrays
Lists in Python.
CS 106 Computing Fundamentals II Chapter 71 “Indexing”
Java Array ISYS 350.
Chapter 8 Arrays Objectives
Visual Basic 6 Programming.
ARRAYS 1 GCSE COMPUTER SCIENCE.
Why arrays are cool 4/25/2007.
Starter As the teacher is calling out the register think about what sort of program you would write to duplicate the process that the teacher has just.
Arrays ICS2O.
JavaScript onLoad arrays
Arrays.
Building Java Programs
CIS16 Application Development and Programming using Visual Basic.net
Arrays Part 2.
Chapter 8 Arrays Objectives
Visit for more Learning Resources
8-2 Special Right Triangles
Learning Intention I will learn how to use an array to store data in a program.
Data Structures & Algorithms
To understand what arrays are and how to use them
Using a Queue Chapter 8 introduces the queue data type.
And now for something completely different . . .
Using a Queue Chapter 8 introduces the queue data type.
CS150 Introduction to Computer Science 1
CS149D Elements of Computer Science
Using a Queue Chapter 8 introduces the queue data type.
GCSE Computing:: Iteration (For Loops)
Just Basic Lessons Mr. Kalmes.
2008/11/19: Lecture 18 CMSC 104, Section 0101 John Y. Park
Using a Queue Chapter 8 introduces the queue data type.
SPL – PS2 C++ Memory Handling.
Presentation transcript:

Don’t Leave Home Without them ARRAYS Don’t Leave Home Without them

Problem: I NEED to hold many values at the same time. SITUATION: But I can only hold a single value at a time with a variable. SOLUTION: USE an ARRAY !!!!!!

An array is a set of elements that are all the same data type. What is an ARRAY?

I need some information from you first. How do I create an array? I need some information from you first.

What type of data do you need to store? I need some Information from you first. Ok…so string!! And how many? Uummm, names ? Idk… 5…. I guess.

Dim strname(4) as String Notice the number isn’t 5. This is how you declare a STRING array of 5. Dim strname(4) as String Notice the number isn’t 5. But it is the spot (or index) of the last element. 0 1 2 3 4 strname

Dim strname(4) as String And, of course, the datatype depends on your data. Now Class try you hand at these array declarations….. I’ll hand out the worksheets!

idk….. Ask the class? What names do you want to store in the array? 0 1 2 3 4 Dim strname(4) as String idk….. Ask the class?

But how do I store data in arrays using Visual Basic? Dim strname(4) as String There are two ways to do that…… 0 1 2 3 4 But how do I store data in arrays using Visual Basic?

First way is with an initializer list. Dim strname() as String= {“Ann”, “Bob”, “Carrie”, “David”, “Elaine”} First way is with an initializer list. Oh ok.

Second way is using a For…Next loop. I love for loops!!!! Dim strname(4) as String Second way is using a For…Next loop. I love for loops!!!!

Oh good. We are going to need that in the for loop. Dim strname(4) as String You need to know that arrays do have a property called length, which returns the number of elements in the array. Oh good. We are going to need that in the for loop.

Dim strname(4) as String Dim intloop as Integer For intloop = 0 to strname.length-1 strname(intloop) =InputBox(“Enter a name:”) Next intloop The index or subscript of the array is the loop variable! I know how to use for loops!

I did it! I’m so smart! I feel transformed! Wow! I’m proud of you! Now CLASS make me proud! Do the Student Names Application on page 9-2 to 9-3 I did it! I’m so smart! I feel transformed!

How big is the array: Dim intstudents(765) as integer? 766 2. Why don’t you use a size when loading with an initializer list? Computer counts the number of items in your list and sizes the array 3. What loop structure goes hand-in-hand with arrays? For Loops 4. What is the property name that gives you the size of the array? length 5. What is the first index of every array? Because I have a collection of elements all of the same datatype. 6. Why do I want to use arrays?