Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.

Slides:



Advertisements
Similar presentations
Arrays.
Advertisements

Pointers and Arrays Chapter 12
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Programming with Microsoft Visual Basic 2005, Third Edition
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
Chapter 8 Arrays and Collections Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Arrays-Part 1. Objectives Declare and initialize a one-dimensional array Store data in a one-dimensional array Display the contents of a one-dimensional.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 8 Arrays.
Computer Science 1620 Multi-Dimensional Arrays. we used arrays to store a set of data of the same type e.g. store the assignment grades for a particular.
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.
Arrays.
1 CSCE 1030 Computer Science 1 Arrays Chapter 7 in Small Java.
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.
User-defined Data Types VB provides programmers with the ability to create user-defined types. User-defined Types are collections of related variables.
McGraw-Hill © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Historical Research Chapter Twenty-Two.
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.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Array Processing Simple Program Design Third Edition A Step-by-Step Approach 7.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Chapter 8 Arrays Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Array Processing.
Introduction to Arrays in Java Corresponds with Chapter 6 of textbook.
Arrays Part 9 dbg. Arrays An array is a fixed number of contiguous memory locations, all containing data of the same type, identified by one variable.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 9 Arrays.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
8-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Arrays Chapter 8.
McGraw-Hill © 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 8 Arrays.
Computer Programming TCP1224 Chapter 11 Arrays. Objectives Using Arrays Declare and initialize a one-dimensional array Manipulate a one-dimensional array.
CPS120: Introduction to Computer Science Lecture 15 Arrays.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
Addressing Modes Chapter 6 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 18 – Student Grades Application Introducing.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Arrays, Timers, and More 8.
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.
 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.
Programming with Microsoft Visual Basic 2012 Chapter 9: Arrays.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
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,
Arrays An array is a list or series of values all referenced by the same name Also referred to as a table An element is an individual item in the array.
An Introduction to Programming with C++ Sixth Edition Chapter 12 Two-Dimensional Arrays.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Arrays What is an array… –A data structure that holds a set of homogenous elements (of the same type) –Associate a set of numbers with a single variable.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
Microsoft Visual Basic 2005: Reloaded Second Edition
Two Dimensional Array Mr. Jacobs.
Java How to Program, Late Objects Version, 10/e
Brief description on how to navigate within this presentation (ppt)
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections
Introduction To Programming Information Technology , 1’st Semester
Arrays Chapter 8 Copyright © 2008 W. W. Norton & Company.
Arrays.
Arrays Part 2.
Programming Logic and Design Fifth Edition, Comprehensive
Programming In Visual Basic .NET
Presentation transcript:

Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San Diego

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Ch. 8: Arrays  Set up and use a control array  Selection construct, Case/End Case  Array of variables  Use For Each/Next loop structure  Direct vs. indirect table access  List ItemData property  Multidimensional arrays

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Control arrays  Control array is a group of like-named controls of same type  Advantage is that controls in array share a single click event  Disadvantage: loss of mnemonic naming  Create control array by assigning each control, in turn, by same name

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Case structure  Case is another selection structure similar to If/Then/Elseif structure  You use case when a variable or expression can be one of several values and If statement would be cumbersome  Any Case statement could be coded as a series of nested If statements.

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Case (continued)  Elements used for constant list are like these: –Case 2, 5, 9 –Case 25 to 50 –Case Is < 14  Case expression can be text as well as numeric  Case Else is a default case activated when none of the other cases apply

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Single Dimensional Arrays  Variable array can contain a list of values  Individual values are called elements  Elements are just like any other variable  You refer to an element using its subscript  Arrays are sometimes called tables  Each array element is of same type

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill For Each/Next Statements  For Each loops let you reference all elements w/o knowing how many there are  Form: For Each variant-var In arrayname statement(s) Next  Also a convenient way to set all controls on a form "", 0, or some other value

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill User-Defined Data Types  You can define your own data types  These user-defined types are sometimes called records because they encompass several data types bundled into one type  You define the type and then assign the type to variables—two steps

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Using Arrays to Tally Stats.  Arrays are often used to accumulate sums for discrete categories represented by each element of an array  Each element is a separate accumulator  How do you ensure that someone doesn't attempt to fill array element 12 when there are only 10 elements?

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Table Lookup  When groups are not numbered in sequence, then you can use table lookup techniques  Table lookup requires you to store an ID along with the value being tallied—at least two different elements  You must search the table for the ID and then update the associated tally.

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Using List Boxes with Arrays  It is handier to use a list box to lookup a value and then use that to access an array element.  List boxes simplify identifying groups because they constrain IDs to the list  ItemData property of a list associates a number with a list box element--even when the list is sorted

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Multidimensional Arrays  You can use 2 subscripts with an array Dim X(1 to 10, 5 to 15) As Integer or Dim X(2,7) As String  First subscript is row; second is column  Printing 2X array requires nested For loops  Application: Shipping rates based on: –weight –distance

Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Hands-on Programming