void SelectSort(int nLen) { for (int i = 0; i < nLen; i++) { int j = i; int nMax = i; while (j < nLen) { if (g_szArray[j] > g_szArray[nMax]) { nMax = j; } j++; } int tmp = g_szArray[i]; g_szArray[i] = g_szArray[nMax]; g_szArray[nMax] = tmp; } }
void SelectSort(int nLen) { for (int i = 0; i < nLen; i++) { int j = i; int nMax = i; while (j < nLen) { if (g_szArray[j] > g_szArray[nMax]) { nMax = j; } j++; } int tmp = g_szArray[i]; g_szArray[i] = g_szArray[nMax]; g_szArray[nMax] = tmp; } }