/******************************************************************************************* * * Function Name: CompareString () * * Author: ZYH * * Version: 1.0.0 * * Date: 2011-6-20 * * Function Description: Input n strings, from small to large output * * The function called by this function list: * * Call the Function list: * * is Table Accessed: * * Modified TABLE: * * input: *string_array_in[]---input array int total---array elements * * output: char *string_array_out[]---output array * * Return value: no * * Other: * * Modified History: 1. Modified: Modified By: Version: revised brief: 2. ***************************************************** /void CompareString (char *string_array_in[], char *string_array_out[], int Total)/* is essentially the choice of sorting method */{int liv_i;////* element lookup, compare wheel number, n elements compare N-1 round/int liv_j; * I elements compare n-1-i times/int small;/* Select Sort method, Store min The subscript of the element */char *temp; /* Swap TEMP variable * for (liv_i = 0; liv_i < total-1; liv_i++) {small = liv_i; for (liv_j = liv_i+1; liv_j < total; liv_j+ +) {if (strcmp (String_array_in[liv_j],string_array_in[small]) <0)/* Cannot use if (String_array_in[liv_j] < String_arra Y_in[small]) */{small = LIv_j; } if (small!= liv_i) {temp = String_array_in[small]; String_array_in[small] = string_array_in[liv_i]; string_array_in[ Liv_i] = temp; (liv_i = 0; liv_i < total; liv_i++) {string_array_out[liv_i] = string_array_in[liv_i];}