1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bogdan [553]
2 years ago
13

Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the

following as input arguments/parameters : an integer array argSource that brings in the values that need to be examined. an integer that gives the size of the array argSource. an integer that gives the threshold value argThreshold. an integer array argTarget whose contents are to be filled by this function with elements from argSource that are less than argThreshold an integer argTargetCount that has been passed by reference to the function findWithinThreshold (this value needs to be filled by this function bas
Computers and Technology
1 answer:
tensa zangetsu [6.8K]2 years ago
8 0

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

/* Type your code for the function findWithinThreshold here. */

void findWithinThreshold(int argSource[], int argsSourseSize, int argThreshold, int argTarget[], int &argsTargetSize)

{

argsTargetSize = 0;

for (int i = 0; i < argsSourseSize; i++)

{

if (argSource[i] <= argThreshold)

argTarget[argsTargetSize++] = argSource[i];

}

}

/* Type your code for the function findWithinLimits here. */

void findWithinLimits(int argSource[], int argsSourseSize, int argLowLimit, int argHighLimit,int argTarget[],int &argTargetCount)

{

argTargetCount = 0;

for (int i = 0; i < argsSourseSize; i++)

{

if (argSource[i]>=argLowLimit && argSource[i] <= argHighLimit)

argTarget[argTargetCount++] = argSource[i];

}

}

int main() {

const int MAX_SIZE = 100;

int source[MAX_SIZE]; //integer array source can have MAX_SIZE elements inside it ;

// user may chose to use only a portion of it

// ask the user how many elements are going to be in source array and

// then run a loop to get that many elements and store inside the array source

int n;

cout << "How many elements: ";

cin >> n;

for (int i = 0; i < n; i++)

{

cout << "Enter " << (i + 1) << " element: ";

cin >> source[i];

}

int threshold, lower_limit, upper_limit;

/* Type your code to declare space for other required data like

target array (think how big it should be)

threshold

lower limit

upper limits

as well as the variable that will bring back the info regarding how many elements might be in target array

*/

int *target = new int[n];

int targetCount;

cout << "\nEnter thresold value: ";

cin >> threshold;

/* Type your code to get appropriate inputs from the user */

cout << "\nEnter lower limit: ";

cin >> lower_limit;

cout << "\nEnter upper limit: ";

cin >> upper_limit;

/* Type your code here to call/invoke the function findWithinThreshold here.. */

/* Type your code to print the info in target array - use a loop and think about how many elements will be there to print */

findWithinThreshold(source, n, threshold, target, targetCount);

cout << "\nElement in the threshold = " << targetCount << endl;

for (int i = 0; i < targetCount; i++)

cout << target[i] << "\n";

/* Type your code here to call/invoke the function findWithinLimits here.. */

/* Type your code to print the info in target array - use a loop and think about how many elements will be there to print */

findWithinLimits(source, n, lower_limit, upper_limit, target, targetCount);

cout << "\n\nElements with in the " << lower_limit << " and "<<upper_limit<<endl;

for (int i = 0; i < targetCount; i++)

cout << target[i] << " ";

cout << endl;

system("pause");

return 0;

}

You might be interested in
Do warnings ever expire?
DIA [1.3K]
What’s a warning? how do i get one haha
7 0
3 years ago
Read 2 more answers
Douglas Engelbart is credited with the invention of _____
kicyunya [14]
He created computer mouse
6 0
3 years ago
Which of these best describes cloud computing? A. an on-demand service that helps to access shared computing and storage resourc
Basile [38]
I think its A. an on-demand service that helps to access shared computing and storage resources from anywhere using an Internet connection
5 0
2 years ago
Who controls communication ethics?
PIT_PIT [208]

B. Government is the correct answer :)

8 0
3 years ago
a colleague shared an excel file with you, and you want to display a worksheet that is hidden in it. how can you do that?
Sonja [21]

The hidden worksheet can be made visible with the right click on any worksheet and select unhide.

<h3>What is a worksheet?</h3>

A worksheet in Microsoft Excel is the collection of the rows and column that has been used to organize data. The collection of worksheets is called workbook.

The hidden worksheets are not visible in the workbook, and if an individual wants to unhide the hidden worksheet, he must right-click on any worksheet and select unhide.

Learn more about worksheet, here:

brainly.com/question/1024247

#SPJ1

4 0
2 years ago
Other questions:
  • A mnemonic is a tool that you can use when you are studying to help you do which of the following?
    15·2 answers
  • What is the purpose of an arraignment?
    9·2 answers
  • PLEASE HELP !!!! WILL UPVOTE
    5·2 answers
  • The Office ____ is a temporary storage area. Warehouse Clipboard Storehouse Gallery
    15·1 answer
  • Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison
    15·1 answer
  • What is the easiest computer programming language​
    12·1 answer
  • 13. Place where names, addresses and email information<br> is stored
    6·1 answer
  • 1 #include 2 3 int max2(int x, int y) { 4 int result = y; 5 if (x &gt; y) { 6 result = x; 7 } 8 return result; 9 } 10 11 int max
    12·1 answer
  • Why doesn't brainly give me 15 questions a day
    11·2 answers
  • Write programs in python to display “Valid Voter”. (condition : age of person should be
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!