9? 1?All 26%. 12:32 AM Quizzes Question 12 Not yet graded/ 6 pts Write a functio
ID: 2293835 • Letter: 9
Question
9? 1?All 26%. 12:32 AM Quizzes Question 12 Not yet graded/ 6 pts Write a function of the form: int getInRange(int n, int in). int out], int nin, int max) which given an integer array inl] and its dimension n, returns an array: outll which contains all the elements of inll that are between min and max. The function explicitly returns the number of elements in outl. For example, given the following inputs: n5 min 10 min20 in: [5 2 15 21 10] Then outll should be: out: [15 10 And the integer 2 returned explicitly. Note: Just write the function here. The main function will be written in another question. Note: Please select the text shown below to get started and paste into your solution (so that it will have the right paragraph style: Preformatted and look like computer code): int getInRange(int n, int in. int out[]. int nin, int max) Your Answer: DashboardExplanation / Answer
int min,int max,int in[] ,int n, int count =0; int out[count],int i,j;
cout<<" Give the Dimensions of the integer array: ";
cin>>n;
cout<<" Give the inputs to the integer array: ";
for(i=0;i<n;i++)
{
cin>>in[i];
}
cout<<" Give the min and max values ";
cin>>min>>max;
for(i=0;i<n;i++)
{
if (in[i] >>min && in[i] <<max)
count++;
}
for(i=0;i<n;i++)
{
if (in[i] >>min && in[i] <<max)
for(j=0;j<count;j++)
out[j]=in[i];
}
return out;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.