Read numbers form user and place them in array:
Program is to read a group numbers of numbers form user and place them in array type of float and sort them
void sort(float a[]);
int i,n;
void main()
{
clrscr();
float a[20];
cout <<" enter no of terms: ";
cin>>n;
cout<<" enter the elements ";
for(i=0; i
{
cin>>a[i];
}
sort(a[i]);
}
void sort(float a[])
{
int t,j,po;
float min;
for(i=0; i
{
min=a[i];
po=i;
for (j=i+1; j
{
if (a[j]
{
min=a[j];
po=j;
}
}
t=a[po];
a[po]=a[i];
a[i]=t;
}
for(i=0;i
cout<<" sorted elements ";
cout<
}