#include<iostream>
using namespace std;
template <class t>
class bubble
{
t a[10];
public:
void get(int);
void sort(int);
void display(int);
};
template <class t>
void bubble <t>::get(int n)
{
int i;
//cout<<"Enter the array elements:\n";
for(i=0; i<n;i++)
cin>>a[i];
}
template <class t>
void bubble <t>::display(int n)
{
int i;
//cout<<"\nThe sorted array is\n";
for(i=0;i<n;i++)
cout<<a[i]<<" ";
}
template <class t>
void bubble <t>::sort(int n)
{
int i,j;
t temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
}
int main()
{
int n,ch;
cin>>ch;
switch(ch)
{
case 1:
{
bubble<int> b1;
cin>>n;
b1.get(n);
b1.sort(n);
b1.display(n);
break;
};
case 2:
{
bubble<float> b2;
cin>>n;
b2.get(n);
b2.sort(n);
b2.display(n);
break;
};
case 3:
{
bubble<char> b3;
cin>>n;
b3.get(n);
b3.sort(n);
b3.display(n);
break;
};
default:
cout<<"Invalid\n";
}
return 0;
}
using namespace std;
template <class t>
class bubble
{
t a[10];
public:
void get(int);
void sort(int);
void display(int);
};
template <class t>
void bubble <t>::get(int n)
{
int i;
//cout<<"Enter the array elements:\n";
for(i=0; i<n;i++)
cin>>a[i];
}
template <class t>
void bubble <t>::display(int n)
{
int i;
//cout<<"\nThe sorted array is\n";
for(i=0;i<n;i++)
cout<<a[i]<<" ";
}
template <class t>
void bubble <t>::sort(int n)
{
int i,j;
t temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
}
int main()
{
int n,ch;
cin>>ch;
switch(ch)
{
case 1:
{
bubble<int> b1;
cin>>n;
b1.get(n);
b1.sort(n);
b1.display(n);
break;
};
case 2:
{
bubble<float> b2;
cin>>n;
b2.get(n);
b2.sort(n);
b2.display(n);
break;
};
case 3:
{
bubble<char> b3;
cin>>n;
b3.get(n);
b3.sort(n);
b3.display(n);
break;
};
default:
cout<<"Invalid\n";
}
return 0;
}