// FILE: SmArrDrv.cpp // DRIVER FOR FUNCTION "same_array" #include #include "apvector.h" #define SIZE 5 #include "SameArra.cpp" // Functions Used... // COMPARES TWO DOUBLE ARRAYS FOR EQUALITY BY COMPARING // CORRESPONDING ELEMENTS bool same_array (const apvector &, // IN: float arrays to be compared const apvector &, const int); // IN: size of the arrays // driver (not included in the figure) int main () { // Local Data... apvector a(SIZE); apvector b(SIZE); bool same; // read in array a cout << endl << "Enter " << SIZE << " numbers seperated by a space for array 1> " << endl; for (int i = 0; i < SIZE; i++) cin >> a[i]; // read in array b cout << endl << "Enter " << SIZE << " number of floats seperated by a space for array 2> " << endl; for (int i = 0; i < SIZE; i++) cin >> b[i]; // do a component-wise comparison of a and b same = same_array(a, b, SIZE); // report the results if (same) cout << endl << "The arrays are equal." << endl; else cout << endl << "The arrays are not equal." << endl; return 0; }