Worked Examples

average.cpp
  • Passing a one dimensional array and its size to a function
  • Using an array parameter in a function
  • Summing a list (array) of numbers while keeping a running total (i.e., using an accumulator variable)
  • Using an array element as both an l- and r-value
  • multtab.cpp (array version)
  • Using nested loops to work with a two dimensional array
  • Passing a two dimensional array as a function argument
  • Using an array element as both an l- and r-value
  • chi2.cpp
  • Converting formulas with Σ notation into C++ code
  • A valid for-loop with a null statement
  • Inputing data from the console into an array until a -1 is entered
  • rms.cpp
  • Converting formulas with √ and Σ into C++ code
  • Entering data from the console into an array
  • Passing an array as a function argument