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
What is a motherboard​
aleksandr82 [10.1K]

Answer:

A motherboard is the main printed circuit board in general-purpose computers and other expandable systems. It holds and allows communication between many of the crucial electronic components of a system

Explanation:

8 0
2 years ago
50 points please!!
MA_775_DIABLO [31]

Answer:

poopypoopypoopypoopy

6 0
3 years ago
How do i confirm my email address on here
Ipatiy [6.2K]
Hi you go to your email and press confirm and it will come back here to this site and it will auto confirm.
7 0
3 years ago
Read 2 more answers
What doe the &amp; operator do in python programming software
ArbitrLikvidat [17]
Hardware software is the answer
5 0
3 years ago
In a(n) ____, the programmer uses a programming language (in context free grammar) to tell the computer what to accomplish and h
Mamont248 [21]

A 5GL fifth-generation languages a programming language design to solve given problem without programmer. The user only needs to solve the problem and condition without implementing an algorithm.

Explanation:

First Generation Language

The first generation language is called low- level style because they were used at a superficial level of abstraction. First-generation language referred to as the native language.

Second Generation Language

The second-generation language is also low-level language or assembly language. The second level of language uses the concept of mnemonics for the writing program. Symbolic name are used.

Third Generation Language

The third-generation language overcomes the first and second-generation languages. Third generation language is considered as high- level language because the target is to focus on the logic of the program.

Fourth Generation Language

The language of generation required a lot of time and effort that affect programmers.The fourth-generation was developed to reduce the time, cost, and effort.

Fifth Generation Language

The programming language of this generation focuses on constraints programming. The fifth-generation programming languages are Artificial Intelligence and Artificial Neural Network.

6 0
3 years ago
Other questions:
  • Which of these statements regarding mobile games is true? A. They are typically played indoors. B. They have detailed environmen
    7·1 answer
  • Universal Containers has implemented a strict software architecture for their custom Apex code. One of the requirements is that
    14·1 answer
  • Assume you have a project with seven activities labeled A-G (following). Derive the earliest completion time (or early finish-EF
    15·1 answer
  • How do you create a logo on Adobe illustrator
    8·1 answer
  • Which group on the home tab contains the line spacing attribute?
    7·1 answer
  • How have productivity programs improved the professional lives of people? (check all that apply)
    8·2 answers
  • What is the importance of human flourishing to science and technology?​
    8·1 answer
  • Besides earning money why do people work​
    6·2 answers
  • To find information on a network use a ____
    14·1 answer
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!