void sort(int array[], int length)
{
  int lcv1;//loop control vairable
  int lcv2;//loop control vairable
  int lcv3 = 0;//loop control variable
  int temp;//temp variable to hold value
  int loc = 0;//location of temp variable

  while ((!checkascend(array, length)) && lcv3 < length)
  {
    temp = 999999999;//set temp to max value
    for(lcv1 = 0; lcv1 < length; lcv1++)
    {
      if(findmin(array, lcv1, length))
      {
        if(temp > array[lcv1])
        {
          temp = array[lcv1];
          loc = lcv1;
        }
      }
    }
    for(lcv2 = loc; lcv2 < length - 1; lcv2++)
    {
      array[lcv2] = array[lcv2 + 1];
    }
    array[length - 1] = temp;
    printdata(array, length, lcv3 + 1);
    lcv3++;
  }
  printmoves(lcv3);
}
示例#2
0
void cmd_moves(char *s){printmoves(tomove());}