01969_PPT_ch06 - Programming Logic and Design Fifth...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 2 Objectives Understand arrays and how they occupy computer memory Manipulate an array to replace nested decisions Use a named constant to refer to an array’s size Declare and initialize an array Understand the difference between variable and constant arrays
Background image of page 2
Programming Logic and Design, Fifth Edition, Comprehensive 3 Objectives (continued) Search an array for an exact match Use parallel arrays Search an array for a range match Learn about remaining within array bounds Use a for loop to process arrays
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 4 Understanding Arrays and How They Occupy Computer Memory Array : Series or list of variables in computer memory All variables share the same name Each variable has a different subscript Subscript (or index ): Position number of an item in an array Subscripts are always a sequence of integers
Background image of page 4
Programming Logic and Design, Fifth Edition, Comprehensive 5 How Arrays Occupy Computer Memory Each item has same name and same data type Element : an item in the array Array elements are contiguous in memory Size of the array : number of elements it will hold
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 6 How Arrays Occupy Computer Memory (continued) Figure 6-1 Appearance of a three-element array and a single variable in computer memory
Background image of page 6
Programming Logic and Design, Fifth Edition, Comprehensive 7 How Arrays Occupy Computer Memory (continued) All elements have same group name Individual elements have unique subscript Subscript indicates distance from first element Subscripts are a sequence of integers Subscripts placed in parentheses or brackets following group name Syntax depends on programming language
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 8 Manipulating an Array to Replace Nested Decisions Example: Human Resources Department Dependents report List employees who have claimed 0 through 5 dependents Assume no employee has more than 5 dependents Application produces counts for dependent categories Uses series of decisions Application does not scale up to more dependents
Background image of page 8
Programming Logic and Design, Fifth Edition, Comprehensive 9 Figure 6-3 Flowchart of decision-making process using a series of decisions – the hard way
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 10 Figure 6-3 Pseudocode of decision-making process using a series of decisions – the hard way (continued)
Background image of page 10
Programming Logic and Design, Fifth Edition, Comprehensive 11 Manipulating an Array to Replace Nested Decisions (continued) Array reduces number of statements needed Six dependent count accumulators redefined as 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
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 12 Figure 6-4 Flowchart and pseudocode of decision-making process – but still a hard way
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/18/2011 for the course COMP 230 taught by Professor Deokar during the Summer '11 term at DeVry Cincinnati.

Page1 / 50

01969_PPT_ch06 - Programming Logic and Design Fifth...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online