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
Arrays enable the representation of a number of similar items (in terms of their datatypes). They represent these items in an or
frutty [35]

Answer:

Check the explanation

Explanation:

When there is a need to initialize a lot of element of same data types,tht time we use arrays.

We have to use array  whenever it involves simple programs and cases,

dx:saving age of 100 childrans of sametype

When all the ele,ents are of different data type,we hould not use arrays,even when we initialize at runtime,we dont need arrays.i.e when size is not fixed

Linked list can be used instead of arrays

ArrayList:It provides methods for creating, searching, manipulating, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.

Advantages:

Readymade properties availaible ,so lot of writing and remembering the code can be avoided.

Provide the reference for other arrays

Helps in faster execution

4 0
4 years ago
What will happen if Sam goes to the View menu, clicks Toolbars, and then clicks Picture?
elena-s [515]
I think the correct answer from the choices listed above is option C. If Sam goes to the View menu, clicks Toolbars, and then clicks Picture, then the picture toolbar will appear. Hope this answers the question. Have a nice day. Feel free to ask more questions.
4 0
3 years ago
Read 2 more answers
Define and test a function myRange. This function should behave like Python’s standard range function, with the required and opt
Cerrena [4.2K]

Answer:

Study Python’s help on range to determine the names, positions, and what to do with your function’s parameters.

Use a default value of None for the two optional parameters. If these parameters both equal None, then the function has been called with just the stop value. If just the third parameter equals None, then the function has been called with a start value as well. Thus, the first part of the function’s code establishes what the values of the parameters are or should be. The rest of the code uses those values to build a list by counting up or down.

6 0
3 years ago
Read 2 more answers
The simplest element that exists is only one proton and one electron. It is what stars are made of. It's symbol is "H". What is
lesya [120]

Answer:

Hydrogen.

Explanation:

Hydrogen is the simplest element that exists. The symbol for the chemical element Hydrogen is "H" and it is a colourless, tasteless, odorless, and highly flammable gas.

Hydrogen is a chemical element found in group (1) of the periodic table and as such it has one (1) electrons in its outermost shell. Therefore, Hydrogen has an atomic number of one (1) and a single valence electrons because it has only one proton and one electron in its nucleus.

Additionally, all stars are made up of Hydrogen.

A star is a giant astronomical or celestial object that is comprised of a luminous sphere of plasma, binded together by its own gravitational force. Stars are typically made up of two (2) main hot gas, which are Hydrogen (H) and Helium (He).

6 0
3 years ago
True or false. two popular electronic image formats are pdf and xps.
kenny6666 [7]
False. You can use, for example, .jpg and .png file formats.
8 0
3 years ago
Other questions:
  • An agile team used planning poker to estimate user stories. After all team members read a user story, the facilitator asks every
    7·1 answer
  • Negative glue effects
    8·1 answer
  • When all RGB colors have the same value, the resulting color will most likely be some variation of _______________.
    11·1 answer
  • Integrity is keeping data consistent and free of errors or anomaliea<br> True or false
    7·1 answer
  • To find out where a particular command is taken from, you can use the _____________ command.
    14·1 answer
  • Give atleast 10 examples of wearable technologies and its functions​
    10·1 answer
  • Company Wizzy is having trouble with network security. Issues with authentication, viruses, malware/spyware, and other network i
    12·1 answer
  • Hannah wanted to watch a movie. She typed the movie name on the search engine. In result she found the downloadable link of the
    10·1 answer
  • Need help with my cs110​
    11·1 answer
  • Microsoft Office PowerPoint 2016 enables you to create robust multimedia _______.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!