asked 42.7k views
4 votes
Assume you need to test a function named inOrder. The function inOrder receives three int arguments and returns true if and only if the arguments are in non-decreasing order: that is, the second argument is not less than the first and the third is not less than the second. Write the definition of driver function testInOrder whose job it is to determine whether inOrder is correct. So testInOrder returns true if inOrder is correct and returns false otherwise.

asked
User Cfl
by
9.0k points

1 Answer

5 votes

Answer:

Now we will try as much as we can to call it as few time as we can, so the;

bool testInOrder()

{

if

(

(inOrder(1,1,1)==true) &&

(inOrder(1,2,3)==true) &&

(inOrder(1,2,2)==true) &&

(inOrder(1,2,1)==false) &&

(inOrder(2,2,1)==false) &&

(inOrder(2,2,3)==true) &&

(inOrder(3,2,2)==false) &&

(inOrder(3,2,1)==false) &&

(inOrder(3,2,3)==false)

return true;

else

return false;

}

answered
User Sylar
by
8.1k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.

Categories