C++ program that determines direction of sorting and reversing it

I need a c++ program that is able to determine whether or not a given array is sorted in ascending or descending order. then after that the program should reverse the direction of order