c Write a predicate function called isStrictlyIncreasing tha

c++

Write a predicate function called isStrictlyIncreasing that checks whether an array of integers contains values that are in strictly increasing order. A declaration of the function is shown above. The function returns true if the elements are in strictly increasing order; otherwise it returns false. For example, it will return true for (-2, 4, 5, 6, 8) and it will return false for (3, 4, 6, 6, 9). Write test code that tests every statement in the function. Use assertions in your test code. Hint: Compare a[i] with a[i + 1] and remember to stop at i = n - 1 so you don\'t access a value past the end of the array.

Solution

bool isStrictlyIncreasing(int a[], int len)

                   (or)

for (int i = 0; i < v.size() - 1; ++i)

{

if (v[i] >= v[i + 1]) return false;

}

return true;

c++ Write a predicate function called isStrictlyIncreasing that checks whether an array of integers contains values that are in strictly increasing order. A dec

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site