#include <iostream>
using namespace std;
void Show(int* pList, int nCount)
{
for (int nIndex = 0; nIndex < nCount; nIndex++)
cout << pList[nIndex] << "\t";
cout << endl;
}
void QuickSelectionSort(int* pList,int nCount)
{
for (int nIndex = 0; nIndex < nCount - 1; nIndex++)
{
int nMinIndex = nIndex;//最小值下标
for (int j = nIndex + 1; j < nCount; j++)
if (pList[j] < pList[nMinIndex])//寻找最小值下标
nMinIndex = j;
//数据的交换
int nSave = pList[nIndex];
pList[nIndex] = pList[nMinIndex];
pList[nMinIndex] = nSave;
}
}
int main(int argc, char* argv[], char* enp[])
{
int pList[] = {15,78,95,65,35,12,47,55,22,77};
int nCount = sizeof(pList) / sizeof(int);
QuickSelectionSort(pList, nCount);
Show(pList, nCount);
system("pause");
return 0;
}