Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

Question Can I collect benefits if I become disabled?

Answered: 1 week ago

Question

Question May I set up a Keogh plan in addition to an IRA?

Answered: 1 week ago