#include<iostream>
#include<iomanip>
usingnamespace std;
int loc=0;
int min(int sort[],int k);
int main()
{
char ch;
do
{
int select[8],k,c,temp;
cout<<"enter 8 elements of array to sort"<<endl;
for (int i=0;i<8;i++)
{
cin>>select[i];
}
cout<<endl;
for(k=0;k<8;k++)
{
c=min(select,k);
temp=0;
temp=select[k];
select[k]=select[loc];
select[loc]=temp;
}
cout<<"array after sort"<<endl;
for ( i=0;i<8;i++)
{
cout<<select[i]<<'\t';
}
cout<<endl;
cout<<"do you want to sort more array"<<endl;
cin>>ch;
}
while(ch!='n');
return 0;
}
int min(int sort[],int k)
{
int mini;
mini=sort[k];
loc=k;
for(int j=k+1;j<=7;j++)
{
if(mini>sort[j])
{
mini=sort[j];
loc=j;
}
}
return mini;
}