#include<iostream> using namespace std; template <class T> void swapit(T &t1, T &t2) { T templ = t1; t1 = t2; t2 = templ; } template <class TT> void sortit(TT l, int size) { int i, j, temp; for(i=1; i<size; i++) { j=i; temp= l[j]; while (j>0 && l[j-1]>l[j]) { swapit(l[j], l[j-1]); j--; } } } int main() { int aaa[10] = {234,45,57,78,56,45,34,56,67,45}; int size = sizeof(aaa)/sizeof(aaa[0]); sortit(aaa, size); for (int i =0;i<size; i++) { cout << aaa[i] << " "; } cout << endl; return 0; }