Презентация Programming Logic and Design Seventh Edition онлайн
На нашем сайте вы можете скачать и просмотреть онлайн доклад-презентацию на тему Programming Logic and Design Seventh Edition абсолютно бесплатно. Урок-презентация на эту тему содержит всего 46 слайдов. Все материалы созданы в программе PowerPoint и имеют формат ppt или же pptx. Материалы и темы для презентаций взяты из открытых источников и загружены их авторами, за качество и достоверность информации в них администрация сайта не отвечает, все права принадлежат их создателям. Если вы нашли то, что искали, отблагодарите авторов - поделитесь ссылкой в социальных сетях, а наш сайт добавьте в закладки.
Презентации » Устройства и комплектующие » Programming Logic and Design Seventh Edition
Оцените!
Оцените презентацию от 1 до 5 баллов!
- Тип файла:ppt / pptx (powerpoint)
- Всего слайдов:46 слайдов
- Для класса:1,2,3,4,5,6,7,8,9,10,11
- Размер файла:1.16 MB
- Просмотров:69
- Скачиваний:0
- Автор:неизвестен
Слайды и текст к этой презентации:
№5 слайд
Содержание слайда: Each item has the same name and the same data type
Each item has the same name and the same data type
Element: an item in the array
Array elements are contiguous in memory
Size of the array: the number of elements it will hold
Subscripts or indexes: indicate the position of a particular element in the array
Adding data values is called populating the array
№7 слайд
Содержание слайда: How an Array Can
Replace Nested Decisions
Example: Human Resources Department Dependents report
List employees who have claimed zero through five dependents
Assume no employee has more than five dependents
Application produces counts for dependent categories
Uses a series of decisions
Application does not scale up to more dependents
№9 слайд
Содержание слайда: How an Array Can Replace
Nested Decisions (continued)
The array reduces the number of statements needed
Six dependent count accumulators are redefined as a single array
Variable as a subscript to the array
Array subscript variable must be:
Numeric with no decimal places
Initialized to 0
Incremented by 1 each time the logic passes through the loop
№16 слайд
Содержание слайда: Using a Constant as
the Size of an Array
Avoid “magic numbers” (unnamed constants)
Declare a named numeric constant to be used every time the array is accessed
Make sure any subscript remains less than the constant value
Constants are created automatically in many languages
№19 слайд
Содержание слайда: Searching an Array for
an Exact Match
Sometimes you must search through an entire array to find a value
Example: mail-order business
Item numbers are three-digit, non-consecutive numbers
Customer orders an item; check if item number is valid
Create an array that holds valid item numbers
Search the array for an exact match
№23 слайд
Содержание слайда: Searching an Array for an Exact Match (continued)
Flag: a variable that indicates whether an event occurred
Technique for searching an array
Set a subscript variable to 0 to start at the first element
Initialize a flag variable to false to indicate the desired value has not been found
Examine each element in the array
If the value matches, set the flag to True
If the value does not match, increment the subscript and examine the next array element
№24 слайд
Содержание слайда: Using Parallel Arrays
Example: mail-order business
Two arrays, each with six elements
Valid item numbers
Valid item prices
Each price in the valid item price array is in the same position as the corresponding item in the valid item number array
Parallel arrays
Each element in one array is associated with an element in the same relative position in the other array
Look through the valid item array for the customer’s item
When a match is found, get the price from the item price array
№26 слайд
Содержание слайда: Using Parallel Arrays (continued)
Use parallel arrays
Two or more arrays contain related data
A subscript relates the arrays
Elements at the same position in each array are logically related
Indirect relationship
Relationship between an item’s number and its price
Parallel arrays are very useful
№33 слайд
Содержание слайда: Searching an Array for
a Range Match
Programmers may want to work with ranges of values in arrays, 1 through 5 or 20 through 30
Example: mail-order business
Read the customer order data; determine the discount based on the quantity ordered
First approach
An array with as many elements as each possible order quantity
Store the appropriate discount for each possible order quantity
№35 слайд
Содержание слайда: Searching an Array for
a Range Match (continued)
Drawbacks of first approach
Requires a very large array; uses a lot of memory
Stores the same value repeatedly
How do you know when you have enough elements?
Customer can always order more
Better approach
Create four discount array elements for each discount rate
A parallel array with a discount range
Use a loop to make comparisons
№38 слайд
Содержание слайда: Remaining within Array Bounds
Every array has a finite size
Number of elements in the array
Number of bytes in the array
Arrays are composed of elements of the same data type
Elements of the same data type occupy the same number of bytes in memory
The number of bytes in an array is always a multiple of the number of array elements
Access data using a subscript containing a value that accesses memory occupied by the array
№40 слайд
Содержание слайда: Remaining within Array Bounds (continued)
Program logic assumes every number entered by the user is valid
When an invalid subscript is used:
Some languages stop execution and issue an error
Other languages access a memory location outside of the array
An invalid array subscript is a logical error
Out of bounds: using a subscript that is not within the acceptable range for the array
The program should prevent bounds errors
№41 слайд
Содержание слайда: Using a for Loop to Process Arrays
for loop: a single statement
Initializes the loop control variable
Compares it to a limit
Alters it
The for loop is especially convenient when working with arrays
To process every element
Must stay within array bounds
Highest usable subscript is one less than the array size
№44 слайд
Содержание слайда: Summary
Array: a named series or list of values in memory
Same data type
Different subscript
Use a variable as a subscript to the array to replace multiple nested decisions
Constants can be used to hold an array’s size
Searching through an array requires
Initializing a subscript
Using a loop to test each element
Setting a flag when a match is found
№46 слайд
Содержание слайда: Summary (continued)
Access data in an array
Use a subscript containing a value that accesses memory occupied by the array
A subscript is out of bounds if it is not within the defined range of acceptable subscripts
The for loop is a convenient tool for working with arrays
Process each element of an array from beginning to end
Скачать все slide презентации Programming Logic and Design Seventh Edition одним архивом:
-
Programming logic and design seventh edition. Chapter 5. Looping
-
Programming Logic and Design Seventh Edition. Chapter 4. Making Decisions
-
Programming Logic and Design Seventh Edition. Chapter 1. An Overview of Computers and Programming
-
Programming Logic and Design. Chapter 7. File Handling and Applications
-
Prolog. A general-purpose logic programming language associated with artificial intelligence and computational linguistics
-
Mathematical functions, characters, and strings. Introduction to Java Programming
-
Internet and Java Foundations, Programming and Practice
-
Operating systems and programming environments. МS DOS. Shell programs Norton Commander, Far Manager
-
Green technologies use in computer science and programming
-
Spring data. Familiar and consistent programming model for data access