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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:00
Howard is designing a chair swing ride. the swing ropes are 5 meters long, and in full swing they tilt in an angle of 29° outside chairs to be 2.75 m above the ground in full swing.
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
Singing in the rain: this first part of the film shows the early history of motion picture. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theater productions? explain.
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
From excel to powerpoint, you can copy and paste a. cell ranges and charts, one at a time. b. cell ranges and charts, simultaneously. c. charts only. d. cell ranges only.
Answers: 3
You know the right answer?
#include using namespace std;
const int SIZE = 4;
bool isSorted(const int arr[], int si...
Questions
Questions on the website: 13722360