Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started