#include<iostream>
using namespace std;

template <class T>
void sort(T *ptr, int size){
   int i,j;
   T temp;
   for(i=0; i<size; i++)
   {
      for(j=0; j<size-1; j++)
      {
        if ( ptr[j+1] < ptr[j])      
        { 
           temp = ptr[j];            
           ptr[j] = ptr[j+1];
           ptr[j+1] = temp;
        }         
      }         
   }
}

template <class T>
void display(T *ptr, int size)
{
   for(int i=0; i<size; i++) {
      cout<<ptr[i]<<endl;      
   }    
   cout<<endl; 
}

main(){
   int a[5] = {4,6,2,1,3};    
   float f[5] = {5.7, 5.1, 4.7, 3.2, 1.5};
   char c[6] = {'z','e','t','b','a'};
   cout<<"int array"<<endl;
   sort(a, 5);
   display(a, 5);
   cout<<"float array"<<endl;
   sort(f, 5);
   display(f, 5);
   cout<<"char array"<<endl;
   sort(c, 5);
   display(c, 5);
   system("pause");
}
