Include Using Namespace Std Const Int Size 4 Bool Issorted Const Int Arr Int Size Bool Isn Q43856342
#include <iostream>
using namespace std;
const int SIZE = 4;
bool isSorted(const int arr[], int size);bool isNonDecreasing(const int arr[], int size);bool isNonIncreasing(const int arr[], int size);void printArr(const int arr[], int size);
int main(){int test1[] = { 4, 7, 10, 69 };int test2[] = { 10, 9, 7, 3 };int test3[] = { 19, 12, 23, 7 };int test4[] = { 5, 5, 5, 5 }; if (!isSorted(test1, SIZE))cout << “NOT “;cout << “SORTED” << endl;printArr(test1, SIZE);
if (!isSorted(test2, SIZE))cout << “NOT “;cout << “SORTED” << endl;printArr(test2, SIZE);
if (!isSorted(test3, SIZE))cout << “NOT “;cout << “SORTED” << endl;printArr(test3, SIZE);
if (!isSorted(test4, SIZE))cout << “NOT “;cout << “SORTED” << endl;printArr(test4, SIZE);
return 0;}
bool isSorted(const int arr[], int size){// TODO: This function returns true if the array is sorted. Itcould be// sorted in either non-increasing (descending) ornon-decreasing (ascending)// order. If the array is not sorted, this function returnsfalse.
// HINT: Notice that the functions isNonDecreasing andisNonIncreasing are not// called from main. Call the isNonDecreasing andisNonIncreasing functions here.}
bool isNonDecreasing(const int arr[], int size){// TODO: Loop through the array to check whether it is sortedin// non-decreasing (in other words, ascending) order. If thearray// is non-decreasing, return true. Otherwise, returnfalse.}
bool isNonIncreasing(const int arr[], int size){// TODO: Loop through the array to check whether it is sortedin// non-increasing (in other words, descending) order. If thearray// is non-increasing, return true. Otherwise, returnfalse.}
void printArr(const int arr[], int size){for (int i = 0; i < size; i++)cout << arr[i] << ” “;
cout << endl << endl;}
Expert Answer
Answer to #include using namespace std;const int SIZE = 4;bool isSorted(const int arr[], int size);bool isNonDecreasing(const int …
OR