You would write a template function or just use std::sort()
[ http://www.cplusplus.com/reference/algorithm/sort/ ]
Edit:
Do you have to do this as an assignment? If so, some idea of what you have already learnt would greatly increase the chances of getting a suggestion that would be appropriate to your knowledge level.