Write the definition of a function named isSorted that receives three arguments: an array of int, an int that indicates the number of elements of interest in the array, and a bool. If the bool argument is true then the function returns true if and only if the array is sorted in ascending order. If the bool argument is false then the function returns true if and only if the array is sorted in descending order. In all other cases the function returns false. You may assume that the array has at least two elements.

Write the definition of a function named isSorted that receives three arguments: an array of int, an int that indicates the number of elements of interest in the array, and a bool.  If the bool argument is true then the function returns true if and only if the array is sorted in ascending order. If the bool argument is false then the function returns true if and only if the array is sorted in descending order. In all other cases the function returns false.  You may assume that the array has at least two elements.

LANGUAGE: C++

CHALLENGE:

Write the definition of a function named isSorted that receives three arguments: an array of int, an int that indicates the number of elements of interest in the array, and a bool.

If the bool argument is true then the function returns true if and only if the array is sorted in ascending order. If the bool argument is false then the function returns true if and only if the array is sorted in descending order. In all other cases the function returns false.

You may assume that the array has at least two elements.

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level