i took the actual theory from cow_theboy's thread 
i upgraded it abit this one would run faster

i upgraded it abit this one would run faster
Code:
#include <stdio>
#include <iostream>
int arr[10];
int flip(int i, int j){ //function to shift array values
int g;
g=arr[i];
arr[i]=arr[j];
arr[j]=g;
}
int main(){
//initialization
int i,j,kh,ih;
arr[0]=5;
arr[1]=1;
arr[2]=3;
arr[3]=2;
arr[4]=10;
arr[5]=8;
arr[6]=7;
arr[7]=4;
arr[8]=9;
arr[9]=6;
//sorting
for (i=0;i<10;i++){
kh=0; //lowest number to start with
for (j=i;j<10;j++){
if (kh < arr[j]){kh = arr[j]; ih=j;} //check for the max in sub list
}
flip(ih,i); //change the values
}
for (i=0;i<10;i++) cout<<arr[i]<<endl; //print out the sorted list
cin>>j; //just to stop the terminal from exiting
return 0;
}