Lecture 25 The Tao that can be talked about is not the true Tao

Slides:



Advertisements
Similar presentations
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Advertisements

1 Arrays Chapter 9. 2 Outline  The array structure (Section 9.1)  Array declaration  Array initialization  Array subscripts  Sequential access to.
ECS15 for and sequence. Comments  Another way to repeat.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
CSC 142 J 1 CSC 142 Arrays [Reading: chapter 10].
Identifiers and Assignment Statements. Data structures In any programming language you need to refer to data The simplest way is with the actual data.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
 For Loops › for (variable set; condition; incremental or decrement){ // loop beginning › } // loop end  While loops › while (condition) { // beginning.
Primitive Variables.
Introduction to Pascal The Basics of Program writing.
1 homework Due today: hw #1 (mailing list printout) readings to date: chapter 1 and chapter read appendix B (3 pages on DOS) and and.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
Variables in Java x = 3;. What is a variable?  A variable is a placeholder in memory used by programmers to store information for a certain amount of.
C Programming – Part 3 Arrays and Strings.  Collection of variables of the same type  Individual array elements are identified by an integer index 
INT213-Week-2 Working with Variables. What is variable
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
1 CSC103: Introduction to Computer and Programming Lecture No 17.
Pointers A variable that holds an address value is called a pointer variable, or simply a pointer.  What is the data type of pointer variables? It’s not.
Data Types Mr Tottman Link. Data Types Programs need to use data for calculations and for output to various devices The best programs will always use.
C Programming Lecture 15 Two Dimensional Arrays. Two-Dimensional Arrays b The C language allows arrays of any type, including arrays of arrays. With two.
C LANGUAGE UNIT 3. UNIT 3 Arrays Arrays – The concept of array – Defining arrays – Initializing arrays.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
ARRAYS.
7 - Programming 7J, K, L, M, N, O – Handling Data.
Choosing Data Types Database Administration Fundamentals
Pointers What is the data type of pointer variables?
Session 2 Basics of PHP.
Pascal Programming Arrays and String Type.
Introduction to Arrays
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
Chapter 6: Data Types Lectures # 10.
Complex data types Complex data types: a data type made of a complex of smaller pieces. Pascal has four very commonly used complex data types: strings,
Chapter 5 Control Statements: switch Statement
Stacks and Queues.
Programming fundamentals 2 Chapter 1:Array
Introduction to Programming Lecture 5
Chapter 8 Arrays Objectives
Arrays in C.
Programming Languages and Paradigms
C++ Arrays.
Lists in Python.
An overview of Java, Data types and variables
Chapter 8 Arrays Objectives
Data type List Definition:
Arrays November 8, 2017.
int [] scores = new int [10];
Chapter 9 One-Dimensional Arrays
ArrayLists.
Chapter 11 Data Structures.
Variables Kevin Harville.
Arrays In this section of notes you will be introduced to a homogeneous composite type, one-dimensional arrays One-dimensional arrays in Pascal.
CS1110 Today: collections.
CSC 142 Arrays [Reading: chapter 12].
Chapter 8 Arrays Objectives
The Data Element.
C Programming Pointers
Introduction to Arrays
Variables Here we go.
Arrays.
Variables and Computer Memory
CS150 Introduction to Computer Science 1
CS149D Elements of Computer Science
Java: Variables, Input and Arrays
The Data Element.
Arrays Imran Rashid CTO at ManiWeber Technologies.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises UTPA – Fall 2012 This set of slides is revised from lecture.
Characters and Strings
CSCE 206 Lab Structured Programming in C
Variables and Constants
Presentation transcript:

Lecture 25 The Tao that can be talked about is not the true Tao Opening line of Tao Te Ching

Arrays Remember strings. They are collections of characters which are stored in memory sequentially. We want to be able to have a sequence of variables of any type. There are many applications when this would be helpful.

Arrays Pascal offers arrays to address this problem. Array is simply a sequence of variables of some type addressable via index. For example: TYPE IntegerArray = ARRAY[1..5] of integer; Size or range Type name Basic type of element Type keyword Array keyword

Arrays TYPE IntegerArray = ARRAY[1..5] of integer; You can now do this: VAR aMyArray : IntgerArray; That is, you can now have a variable of this type! What does this new variable look like in memory? aMyArray[ 1 ] aMyArray[ 2 ] aMyArray[ 3 ] ...

Arrays You can have arrays of any basic types TYPE CharArray = ARRAY[1..10] of char; TYPE BoolArray = ARRAY[1..100] of boolean; TYPE RealArray = ARRAY[1..7] of real; TYPE NegIntArray = ARRAY[-10..10] of boolean; TYPE WhatIsThis = ARRAY[‘a’..’z’] of integer;

Numbers in reverse Write a program which reads in integers into an array and then prints them in reverse.

Grades histogram

Letter frequency Write a program which reads in several English sentences and displays letter frequency histogram

Home work Read 10.1,10.2 Hw #7 due Monday, December 14th (ABSOLUTE DEADLINE) Optional problems: page 473 #1, 2, 6, 13, 15 Look at last year’s final Start reviewing

Programs from this lecture Numbers in reverse Grade histogram1 Grade histogram2 Letter frequency