Guest User

Untitled

a guest
Apr 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. void arrSelectSort(float *arr, int size)
  2. {
  3.    int startScan, minIndex;
  4.    float minElem;
  5.  
  6.    for (startScan = 0; startScan < (size - 1); startScan++)
  7.    {
  8.       minIndex = startScan;
  9.       minElem = *(arr + startScan);
  10.       for(int index = startScan + 1; index < size; index++)
  11.       {
  12.          if (*(arr + index) < minElem)
  13.          {
  14.             minElem = *(arr + index);
  15.             minIndex = index;
  16.          }
  17.       }
  18.       *(arr + minIndex) = *(arr + startScan);
  19.       *(arr +startScan) = minElem;
  20.    }
  21. }
Add Comment
Please, Sign In to add comment