//Select Sort, if you need to know the algorithm for finding the minimum and maximum numbers in an array# include<stdio.h># include<stdlib.h># include<time.h>intMain () {//generating an array using time random numberstime_t ts; unsignedintData = Time (&ts); Srand (data); inta[Ten]; for(inti =0; I <Ten; i++) {A[i]= rand ()% -; printf ("%d\n", A[i]); } for(inti =0; I <9; i++) { intmin = i;//Suppose that the first number is considered the smallest numberprintf"\n%d,%d,%d,%d", I, Min, a[i], a[min]);//Note Column-based observations for(intj = i +1; J <Ten; J + +)//define the variable J to traverse, notice that the start of the traversal is the second to start { if(A[j] < a[min])//If there is a number smaller than the number subscript min, the subscript of the small number is given to min{min=J; } } if(min! = i)//if Min is different from the previous I, then you have to Exchange { intt =A[min]; A[min]=A[i]; A[i]=T; } } for(inti =0; I <Ten; i++) {printf ("%d", A[i]); } System ("Pause");}
C Language Selection sorting