Chapter 9: Vectors and Arrays II

Chapter Goals

Parallel Vectors

Parallel Vectors (bestval1.cpp)

Parallel Vectors (bestval2.cpp)


Arrays

Syntax 9.3: Array Variable Definition

Syntax 9.3 : Array Variable Definition

type_name variable_name[size];
Example:
int scores[20];
Purpose: Define a new variable of an array type.

Array Parameters

Array Parameters (salarray.cpp)


Character Arrays

Character Arrays (append.cpp)


Two-Dimensional Arrays

Syntax 9.4: Two-Dimensional Array Definition

Syntax 9.4 : Two-Dimensional Array Definition

type_name variable_name[size1][size2];
Example:
double monthly_sales[NREGIONS][12];
Purpose: Define a new variable that is a two-dimensional array.

Two-Dimensional Arrays (matrix.cpp)