void sort(int *array, int n)
{
int temp;
for (int i = 0; i< n - 1; i++)
{
int index = i;
for (int j = i + 1; j < n; j++)
if (array[j] < array[index])
index = j;
if (index != i)
{
temp = array[i];
array[i] = array[index];
array[index] = temp;
}
}
}
int main() {
int array[8] = { 1,10,5,3,6,8,70,12 };
sort(array, 8);
for (int i = 0; i < 8; i++) {
cout << array[i] << '\t';
}
cout << endl;