logo CodeStepByStep logo

sorted

Language/Type: C++ arrays traversals

Write a function named sorted that accepts an array of doubles and its length as parameters and returns true if the list is in sorted order and false if not. For example, if an array named list stores {1.5, 4.3, 7.0, 19.5, 25.1, 46.2} respectively, the call of sorted(list, 6) should return true. You may assume the array has at least one element. A one-element array is considered to be sorted. Do not modify the array passed in.

Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.