1 / 6

Week 12 Lecture slides

Cosc 1P03. “Example is not the main thing in influencing others, it is the only thing.” Albert Schweitzer. Week 12 Lecture slides. Arrays. collections of values (objects) elements use declare create process memory model length attribute Returns the size of the array.

rowena
Download Presentation

Week 12 Lecture slides

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cosc 1P03 “Example is not the main thing in influencing others, it is the only thing.” Albert Schweitzer Week 12 Lecture slides

  2. Arrays • collections of values (objects) • elements • use • declare • create • process • memory model • length attribute • Returns the size of the array. • RainFall Example • Print out only those months with above average rainfall. • Palindrome Example • Strings as array of char • toCharArray & String(char[])

  3. Processing “Variable-sized” Arrays • Example: standard deviation of student marks • data file • Array of Student objects • Array size not known • choose arbitrary size (constant) • keep count • Array organization • not all elements used • Std Dev formula:

  4. Reading data • traversal • Student constructor • termination • no more data • no more space • error • Computing standard deviation • array as parameter • second traversal • Traversal pattern

  5. Arrays vs Sounds

  6. Good Luck on your Exam!!

More Related