subject

#include 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. It could be
// sorted in either non-increasing (descending) or non-decreasing (ascending)
// order. If the array is not sorted, this function returns false.
// HINT: Notice that the functions isNonDecreasing and isNonIncreasing are not
// called from main. Call the isNonDecreasing and isNonIncreasing functions here.
}
bool isNonDecreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-decreasing (in other words, ascending) order. If the array
// is non-decreasing, return true. Otherwise, return false.
}
bool isNonIncreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-increasing (in other words, descending) order. If the array
// is non-increasing, return true. Otherwise, return false.
}
void printArr(const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 16:50, lukeakalucas
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
image
Computers and Technology, 24.06.2019 01:00, cheycheybabygirl01
How can the temperature of a room be raised by 5degreesf?
Answers: 1
image
Computers and Technology, 24.06.2019 02:40, homework1911
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
image
Computers and Technology, 24.06.2019 05:30, MegRasmussen31
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
You know the right answer?
#include using namespace std;
const int SIZE = 4;
bool isSorted(const int arr[], int si...

Questions in other subjects:

Konu
Mathematics, 27.10.2020 16:50
Konu
Mathematics, 27.10.2020 16:50
Konu
History, 27.10.2020 16:50
Konu
Mathematics, 27.10.2020 16:50