// File: array.h // // An array class for testing sorting algorithms #ifndef _array_h #define _array_h #include #include #include #include #define DATA float #define DSIZE 50 class Array { public: Array(int n=DSIZE, long seed=0) ; // constructor ~Array() { delete [] arr ; } // destructor void print() ; // dump array to screen bool check() ; // is array sorted? DATA *arr ; // pointer to dynamically allocated array // Inline functions // inline int length() { return size; } inline DATA& operator[](int) ; private: long seed ; int size ; } ; // Inline functions not defined in the declaration // inline DATA& Array::operator[](int i) { // debugging mode // assert(i >= 0) ; assert(i < size) ; return arr[i] ; } #endif