Download presentation
Presentation is loading. Please wait.
1
March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class StatusStatus –Survey –Returning homework ArraysArrays –What are they? –Declaring them –Initializing them –Working with them
2
March 2005 2R. Smith - University of St Thomas - Minnesota Arrays Variables and egg cartonsVariables and egg cartons Arrays as sets of variablesArrays as sets of variables –All the same type What are they for?What are they for? –any time you’re collecting a lot of data items –Sorting, analyzing, comparing, aggregating
3
March 2005 3R. Smith - University of St Thomas - Minnesota Talking about arrays How do we ‘declare’ an arrayHow do we ‘declare’ an array –What do we need to specify? –Size matters How do we select individual elements?How do we select individual elements? What’s the difference between using an array element and a ‘normal’ variable?What’s the difference between using an array element and a ‘normal’ variable?
4
March 2005 4R. Smith - University of St Thomas - Minnesota Initializing an array What if we refer to an elementWhat if we refer to an element –and it hasn’t been initialized? –How does this compare to “normal” (primitive) variables? Initializing with statementsInitializing with statements Initializing during declarationInitializing during declaration –Example “sum”
5
March 2005 5R. Smith - University of St Thomas - Minnesota Fibonacci example Create an arrayCreate an array Fill with the Fibonacci sequenceFill with the Fibonacci sequence Calculate the Golden SectionCalculate the Golden Section
6
March 2005 6R. Smith - University of St Thomas - Minnesota Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by- sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.