C语言选择排序

来源:百度知道 编辑:UC知道 时间:2024/05/13 23:59:04
比如数组{ 6 8 10 1 2 7 9} 用选择排序怎么用,会的教下,XX

/*帮你写好了*/

#include <stdio.h>
#include <conio.h>

void SelectSort ( int array[], int nSize )
{
    int nMinIndex;
    int nIndex_1, nIndex_2;
    
    for (nIndex_1 = 0;nIndex_1 < nSize - 1 ;nIndex_1++)  //这个呢负责把待排序的数列走几趟..
    {
        nMinIndex = nIndex_1;
        
        for (nIndex_2 = nIndex_1 + 1 ; nIndex_2 < nSize;nIndex_2++)  //这个呢..是走一趟.然后找到最值.
        {