#include <iostream>
using namespace std;
template<typename T>
void sort(T a[],int &m,int &n)
{
int max=min=a[0],i,t,s;
for(i=1;i<5;i++)
if(a[i]>max)
{
t=max;
max=a[i];
a[i]=t;
m=i;
}
if(a[i]<min)
{
s=min;
min=a[i];
a[i]=s;
n=i;
}
}
int main()
{
int a[]={1,2,3,4,5};
float b[]={1.1,1.3,1.2,2.2,3.3};
double c[]={1.1,2.2,3.3,4.4,5.5};
int i,m,n;
sort(a,m,n);
cout<<"a:";
for(i=0;i<5;i++)
cout<<a[m]<<a[n]<<endl;
sort(b,m,n);
cout<<"b:";
for(i=0;i<5;i++)
cout<<b[m]<<b[n]<<endl;
sort(c,m,n);
cout<<"c:";
for(i=0;i<5;i++)
cout<<c[m]<<c[n]<<endl;
return 0;
}
using namespace std;
template<typename T>
void sort(T a[],int &m,int &n)
{
int max=min=a[0],i,t,s;
for(i=1;i<5;i++)
if(a[i]>max)
{
t=max;
max=a[i];
a[i]=t;
m=i;
}
if(a[i]<min)
{
s=min;
min=a[i];
a[i]=s;
n=i;
}
}
int main()
{
int a[]={1,2,3,4,5};
float b[]={1.1,1.3,1.2,2.2,3.3};
double c[]={1.1,2.2,3.3,4.4,5.5};
int i,m,n;
sort(a,m,n);
cout<<"a:";
for(i=0;i<5;i++)
cout<<a[m]<<a[n]<<endl;
sort(b,m,n);
cout<<"b:";
for(i=0;i<5;i++)
cout<<b[m]<<b[n]<<endl;
sort(c,m,n);
cout<<"c:";
for(i=0;i<5;i++)
cout<<c[m]<<c[n]<<endl;
return 0;
}