Here are some exercises that we may complete in class

  • Count the number of “3” in a string using substr
  • Modify this code to use array notation
  • Go over array notation from slides
  • Create code to read in a bunch of integers with a -1 to stop
  • Do the following examples on the board
    • Write a function to create the sum of all of the integers
    • Write a function to multiply each integer by 2
    • Write a function to print out the number of stars specified by the integer
  • Use the sound example to do the following
    • Introduce a 2 second echo
    • Notice that it has multiple echoes, copy the array
    • Speed it up to double speed
    • Slow it down to half speed
    • Reverse it using a temporary variable
  • Do the landscape example
    • Have one student write code to initialize a two dimensional array
    • show them how to write the code out to a file by inputting the file name
    • Bring it up in excel and graph it
  • Do vectors and show how the parking attendant moves the cars
cs-142/ch6exercises.txt · Last modified: 2015/01/07 09:08 by ryancha
Back to top
CC Attribution-Share Alike 4.0 International = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0