// FILE: AddArr.cpp // STORES THE SUM OF a[i] AND b[i] IN c[i] void add_array (int size, // IN: the size of the three arrays const apvector & a, // IN: the first array const apvector & b, // IN: the second array apvector & c) // OUT: result array // Array elements with subscripts ranging from 0 to size-1 // are summed element by element. // Pre: a[i] and b[i] (0 <= i <= size-1) are defined // Post: c[i] = a[i] + b[i] (0 <= i <= size-1) { // Local data ... int i; // loop control variable // Add corresponding elements of a and b and store in c. for (i = 0; i < size; i++) c[i] = a[i] + b[i]; } // end add_array