#include #include #include using namespace std; int main() { int i, count = 6; // Declare compare function for // sorting. bool compare(string *, string *); // Create array of pointers to // strings. string *animal[6]; animal[0] = new string("raccoon"); animal[1] = new string("bear"); animal[2] = new string("deer"); animal[3] = new string("oppossum"); animal[4] = new string("rabbit"); animal[5] = new string("skunk"); // Print array. for(i = 0; i < count; i++) cout << *animal[i] << " "; cout << endl; // Sort array with STL sort. sort(animal, animal + count, compare); // Print sorted array. for(i = 0; i < count; i++) cout << *animal[i] << " "; cout << endl; return EXIT_SUCCESS; } // User defined compare function // for sort. bool compare(string *s1, string *s2) { return *s1 < *s2; }