#ifndef DANS_ARRAY_UTILS #define DANS_ARRAY_UTILS #include using namespace std; // Print the array ary of size size to the screen void PrintArray(const string ary[], size_t size); // Load the contents of the file filename into the array ary // return the size, but do not exceed MAX // // Print error on truncation // Print error on bad file name void LoadArray(string ary[], size_t & size, size_t MAX, string fileName, string destName); // Store the contents of ary of size size into the file name filename // // Print an error on bad file name. void StoreArray(const string ary[], size_t size, string fileName); // Find the elements common to source1 and source2 and place them in // the array dest. void FindCommon( const string source1[], size_t size1, const string source2[], size_t size2, string dest[], size_t & destSize); // Merge the contests of source1 and source2. The names should be // unique, so if a name is in both arrays it is only added once. // Return the results in dest and destSize // // Print error on truncation. void Merge( const string source1[], size_t size1, const string source2[], size_t size2, string dest[], size_t & destSize, size_t MAX_SIZE, string destName); // Find the names that are in source1 but not in source1. Store the result // in dest and destSize void FindDiff( const string source1[], size_t size1, const string source2[], size_t size2, string dest[], size_t & destSize); // return true key is in the array, false otherwise. bool Find(const string ary[], size_t size, string key); // Sort the array. void Sort(string ary[], size_t size); // Copy the names from the source to the destination void Copy(const string source[], size_t sourceSize, string dest[], size_t & destSize); // Add key to the array // // Print error on truncation. void AppendToArray(string source[], size_t & size, size_t MAX, string key, string aryName); // Delete a name from the array. void DeleteFromArray(string source[], size_t & size, string name); #endif