View the step-by-step solution to:

Question

-Build a function that takes an array a of size n and returns another array that first disregards the numbers

greater than a certain threshold (also a passed parameter), and then stores the remaining elements of the array a first in an increasing order and then in a decreasing order

-i.e:

If a = {5,4,1,12,0,2} and threshold = 10, the returned array should be = {0,1,2,4,5,5,4,2,1,0}.


-In the main method, the user is asked to enter the size of array a, the value of the threshold, as well as all the elements of array a.

Top Answer

#include<iostream> using namespace std ; void IncreasingDecreasing ( int a[], int n, int threashold) { int k= 0 ,p= 0... View the full answer

IncDec Output.JPG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question