Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 19 A Ray of Sunshine.

Slides:



Advertisements
Similar presentations
1.
Advertisements

Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 10 Arrays and Tile Mapping Starting Out with Games & Graphics.
One Dimensional Arrays
Programming Logic and Design Sixth Edition
Chapter 7: Sub and Function Procedures
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Programming with Microsoft Visual Basic 2005, Third Edition
VBA Modules, Functions, Variables, and Constants
An Introduction to Programming with C++ Fifth Edition Chapter 10 Void Functions.
An Introduction to Programming with C++ Fifth Edition
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.
Introduction to Arrays Chapter 7 Why use arrays? To store & represent lists of homogeneous values To simplify program code To eliminate the need to reread.
Arrays.
Guide To UNIX Using Linux Third Edition
Introduction to Programming with C++ Fourth Edition
Chapter 9 Introduction to Arrays
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
Chapter 8: String Manipulation
Programming with Microsoft Visual Basic th Edition CHAPTER SEVEN SUB AND FUNCTION PROCEDURES.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Flag Quiz Application Introducing One-Dimensional Arrays and ComboBox es.
1 Microsoft Visual Basic 2010 Arrays. 2 Using a One-Dimensional Array Lesson A Objectives After completing this lesson, you will be able to:  Declare.
Array Processing Simple Program Design Third Edition A Step-by-Step Approach 7.
Chapter 7 One-Dimensional Arrays 7.1 Arrays in C One of the more useful features of C is the ability to create arrays for storing a collection of related.
Array Processing.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 9 Arrays.
Arrays Module 6. Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array.
Arrays The concept of arrays Using arrays Arrays as arguments Processing an arrays data Multidimensional arrays Sorting data in an array Searching with.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Java Script: Arrays (Chapter 11 in [2]). 2 Outline Introduction Introduction Arrays Arrays Declaring and Allocating Arrays Declaring and Allocating Arrays.
Chapter 6: Arrays: Lists and Tables
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Chapter 6: The Repetition Structure
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Chapter 12: String Manipulation Introduction to Programming with C++ Fourth Edition.
Visual C++ Programming: Concepts and Projects Chapter 11B: Pointers (Tutorial)
An Introduction to Programming with C++ Fifth Edition Chapter 11 Arrays.
Computer Programming TCP1224 Chapter 11 Arrays. Objectives Using Arrays Declare and initialize a one-dimensional array Manipulate a one-dimensional array.
1.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Three Memory Locations and Calculations.
Chapter 9 Processing Lists with Arrays. Class 9: Arrays Understand the concept of random numbers and how to generate random numbers Describe the similarities.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Ten Structures and Sequential Access Files.
Programming with Microsoft Visual Basic 2012 Chapter 9: Arrays.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 13 How Long Can This Go On?
An Introduction to Programming with C++ Sixth Edition Chapter 13 Strings.
1 Chapter 7 Arrays. 2 Outline and Objective In this chapter we will Learn about arrays One-dimensional arrays Two-dimensional arrays Learn about searching.
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.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 11 So Many Paths … So Little Time.
Chapter 10 So Many Paths … So Little Time (Multiple-Alternative Selection Structures) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Object-Oriented Application Development Using VB.NET 1 Chapter 11 Using Multiple Forms with Problem Domain Classes.
Visual C# 2005 Using Arrays. Visual C# Objectives Declare an array and assign values to array elements Initialize an array Use subscripts to access.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
Lecture #15 ARRAYS By Shahid Naseem (Lecturer). 2 ARRAYS DEFINITION An array is a sequence of objects of same data type. The objects in an array are also.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
Chapter 9 Introduction to Arrays Fundamentals of Java.
Programming Right from the Start with Visual Basic .NET 1/e
Chapter 6: Using Arrays.
An Introduction to Programming with C++ Sixth Edition
Microsoft Visual Basic 2005: Reloaded Second Edition
Microsoft Visual Basic 2005 BASICS
Tutorial 11 Arrays Tutorial 11: Arrays.
CIS16 Application Development and Programming using Visual Basic.net
Arrays Part 2.
Programming Logic and Design Fifth Edition, Comprehensive
Presentation transcript:

Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 19 A Ray of Sunshine

Clearly Visual Basic: Programming with Visual Basic 2008 Objectives Explain the purpose of an array Create a one-dimensional array Store data in a one-dimensional array Sort the contents of a one-dimensional array Search a one-dimensional array 2

Clearly Visual Basic: Programming with Visual Basic 2008 Let’s Join the Group Simple variable (scalar variable) –One that is unrelated to any other variable in memory Array of variables –Group of related variables Each variable in an array –Has the same name and data type Subscript –Unique number used to distinguish one variable in a one-dimensional array from another 3

Clearly Visual Basic: Programming with Visual Basic 20084

5

6

Let’s Join the Group (continued) Elements in a numeric array –Initialized to the number 0 Elements in a String array –Initialized to the empty string Populating the array –Assigning initial values to an array 7

Clearly Visual Basic: Programming with Visual Basic 20088

My Friends Application Will perform the following tasks: –Store four names in a one-dimensional String array named strFriends –Display the contents of the array in three label controls named: lblOriginal, lblAscending, and lblDescending To sort a one-dimensional array in descending order: –First, sort the values in ascending order; then use Array.Reverse method to reverse array elements 9

Clearly Visual Basic: Programming with Visual Basic 2008 Salary Application Will store six salary amounts in a one-dimensional Integer array named intSalaries Each salary amount corresponds to a salary code –The valid codes are the numbers 1 through 6 Figure 19-9 –Shows planning information for the application Before accessing an array element: –Procedure should verify that the subscript is valid 10

Clearly Visual Basic: Programming with Visual Basic

Clearly Visual Basic: Programming with Visual Basic 2008 States Application Stores the names of nine states in a one- dimensional String array named strStates Names are stored in the order each was visited by the user Interface provides a text box for the user to enter a state name Figure –Shows planning information for the application Figure –Shows Step Four of algorithm 12

Clearly Visual Basic: Programming with Visual Basic

Clearly Visual Basic: Programming with Visual Basic

Clearly Visual Basic: Programming with Visual Basic 2008 Summary Variables in an array –Have the same name and data type Each element in a one-dimensional array –Identified by a unique subscript that appears in parentheses after the array’s name When declaring a one-dimensional array: –Provide either the highest subscript or the initial values 15

Clearly Visual Basic: Programming with Visual Basic 2008 Summary (continued) Number of elements in a one-dimensional array –One number more than its highest subscript Refer to an element in a one-dimensional array –Using the array’s name followed by the element’s subscript You can use array variables just like any other variable 16

Clearly Visual Basic: Programming with Visual Basic 2008 Summary (continued) One-dimensional array’s Length property –Contains an integer that represents the number of elements in the array Array.Sort method –Sorts elements in a one-dimensional array in ascending order Array.Reverse method –Reverses the order of the elements in a one- dimensional array 17