Code /* array6.cpp CIS 250 David Klick 2005-02-06 Demonstration of string handling and sorting. */ #include #include #include using std::cout; using std::endl; using std::string; void displayArray1(string s[], int len); void displayArray2(char names[][15], int len); void sortArray1(string s[], int len); void sortArray2(char names[][15], int len); int main(void) { string s[] = {"Dave", "Bob", "Sue", "Ken", "Mary"}; char names[][15] = {"Dave", "Bob", "Sue", "Ken", "Mary"}; displayArray1(s, 5); displayArray2(names, 5); sortArray1(s, 5); sortArray2(names, 5); displayArray1(s, 5); displayArray2(names, 5); return 0; } void displayArray1(string s[], int len) { for (int i=0; i0? ", " : "") << s[i]; } cout << endl; } void displayArray2(char s[][15], int len) { for (int i=0; i0? ", " : "") << s[i]; } cout << endl; } void sortArray1(string s[], int len) { string tmp; for (int i=0; i 0) { strcpy(tmp, s[i]); strcpy(s[i], s[j]); strcpy(s[j], tmp); } } } }