|
Lab Midterm
Review - Fall 2008
The lab midterm will cover Chapters 1-5 and 12 in the Savitch
text.
See
the Midterm review document
for
the programming related material you should be familiar with from
Chapters 1 - 4.
Chapter 12 (12.1 and 12.2) - File I/O
I/O file streams and data files. Be able to use ifstream
and ofstream objects to read and write data to a file. Know the
open(),
close(), fail() and eof() functions. Also, know
the different ways to determine the number of records in a data file:
1) including this number as the first entry in the file, 2) using a
sentinel as the last entry, and 3) checking for the end-of-file mark.
Chapter 5 - Arrays
One Dimensional Arrays
Know how to declare and initialize one-dimensional arrays, e.g.,
const
int ITEMS = 4;
double temperature[ITEMS] = {99.1, 98.3, 94.6,
95.5};
Know how to use array subscripts (e.g., temperature[i]),
especially in a loop.
Know how to pass an array to a function. Remember, use the
array name in the function call, along with the size of the array:
max = maxi(
temperature, ITEMS); // call
Also remember that the function must know if a parameter is an array
-
use [] to indicate it:
double maxi(double
temp
[], int SIZE) // header
Know what a "partially filled arry" is and how to use it.
Two-Dimensional Arrays and Matrices
Know how to declare and initialize two dimensional arrays.
Know how to pass 2D arrays to functions. Remember that the
number of column elements must be provided:
void display( double
temp[][limit], int nrows, int ncols)
Matrices are 2D arrays, of course, so know how to use them.
You do not need to memorize the matrix multiply algorithm.
|