Cognizant interview question

How to sort using for loop in C++