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]
3 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]3 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
PLZ HELP What will be the output? class num: def init (self.a): self. number = a mul* __(self. b) return self. number + b. numbe
Vilka [71]

Answer:

15

Explanation:

got it right on edge

3 0
3 years ago
What file system supported by windows can be used for volumes and drives that don’t hold the windows installation? (choose all t
Vikki [24]

Answer:

What file system supported by Windows can be used for volumes and drives that don't hold the Windows installation? (Choose all that apply.) Correct! Correct. exFAT file system is supported by Windows and is used for large external storage devices that may be used with other operating systems.

Explanation:

8 0
3 years ago
PLEASE HELP ME!!!!
White raven [17]
The answers are D and A
5 0
3 years ago
Read 2 more answers
What do you enter at the command prompt to prevent the shell from using to much of the systems resources?
kap26 [50]

Answer:

Ulimit is the correct answer for the above question.

Explanation:

The Linux operating system is a system on which a user can work on multiple programming system. If a user is working on multiple programs then he needs to set the limit for the system resources so that the system can not access so many resources for any particular program and he can able to access multiple programs. For this a user needs to use the Ulimit command which syntax is as follows--

ulimit [-A] (Where A can be any of them (a, b, c, d, e, f, H, i, l, m, n, p, q, r, s, S, t, T, u, v, x) which refers the type of and units of resources.)

The question asked about the command which is used to prevent to use many of the system resources, then the answer is Ulimit command which is described above.

3 0
3 years ago
The most fundamental components of storage that users interact with are the:
Levart [38]
<span>A file can contain the instructions of a computer program or the data that you care to store.

so the answer is =  file
</span>
8 0
4 years ago
Other questions:
  • Technician A says copper has a low resistance. Technician B says the length of wire doesn't affect resistance. Who is correct?
    11·1 answer
  • A growing number of large organizations have built internal Web sites that provide opportunities for online social networking am
    7·1 answer
  • What are the basic components of a Production System?
    6·1 answer
  • What is the result of giving the which utility the name of a command that resides in a directory that is not in your search path
    10·1 answer
  • Create a program that will play the “cows and bulls” game with the user. The game works like this: Randomly generate a 4-digit n
    15·1 answer
  • Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name
    8·1 answer
  • Write a main function to do the following: Create a string that can hold up to 30 characters. Create an array of 10 strings with
    11·1 answer
  • Which command should you use if you want your workbook with a different file name?
    15·1 answer
  • Paravirtualization is ideal for
    9·1 answer
  • What is a common citation style used by students for English classes?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!