Question: need help on this problem using array and method Write an int function named outOfOrder that takes as parameters an array of double and an

 need help on this problem using array and method Write an

need help on this problem using array and method

Write an int function named outOfOrder that takes as parameters an array of double and an int, size. This function will test this array for being out of order, meaning that the array violate the condition: alojc alilc al2c,.. The function returns -1 if the elements are not out of order; otherwise, it will return the index of the first element of the array that is out of order. For example, consider the declaration double a 10] 1.2, 2.1, 3.3, 2.5,45, 7.9, 5.4, 8.7,9.9, 1.01; in this array, al2] and al3] are the first pair out of order a[3] is the first element out of order, so the function rturns 3. If the array were sorted the function would return -1. Use this function in a main function to test it: Ask the user to enter set of number until a negative number is entered. Let the user know if the number entered are out of order or not, let the user know the first number that broke the order, if the order is broken, then print the list of number entered 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!