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
Assign sub_lyric by slicing rhyme_lyric from start_index to end_index which are given as inputs. Sample output with inputs: 4 7
N76 [4]

sub_lyric = rhyme_lyric[start_index:end_index]

8 0
3 years ago
Word how to create a text box with lines 2013
Crank
U go on your keypad and where the numbers are at next to the 0 u see this ------------------------- so u can make lines with that


I hope this help*static*
4 0
4 years ago
Bukod sa nakasulat na impormasyon ay makakakita rin ng larawan sa internet.​
faltersainse [42]

i woud love to help but i dont understand the language

7 0
2 years ago
Choose all items that represent characteristics of an HTML element. used to include additional information in an attribute consi
Sphinxa [80]

Answer:

Explanation:

We could find different kind of tags in HTML, in this case, we can choose the tag <p> we're going to see all the items about this tag.

We can close the tag with the symbol /

<p> example </p>

We can add id or class in this tag

<p id="example"> example </p>

<p class="example"> example </p>

this help up to add CSS code, but we can add style direct in the HTML code:

<p style="color: red;"> example </p>

In this example the text going to be color red

8 0
4 years ago
Can someone please give me example of three types of loop in pascal (It has to has randomize in it too)
Lubov Fominskaja [6]

Sr.No Loop Type & Description
2 for-do loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
3 repeat-until loop Like a while statement, except that it tests the condition at the end of the loop body. (HOPE THIS HELPS!!)
3 0
3 years ago
Other questions:
  • Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional
    8·1 answer
  • A technology company only hires applicants who are under the age of 30. This company could face possibly _________ consequences
    9·2 answers
  • Today’s mobile phones and some PCs use a touch user interface called a _____ to allow people to control the personal computer.
    7·1 answer
  • What would be advantageous for a laptop user to carry when the laptop gets a lot of use?
    14·1 answer
  • SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA.
    13·1 answer
  • In what software development model does activity progress in a lock-step sequential process where no phase begins until the prev
    7·1 answer
  • Which changes should be made to establish and maintain formal writing conventions? Select two options.
    10·1 answer
  • Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar
    12·1 answer
  • When the Hyper-V role is added to a Windows Server 2016 server, the hypervisor creates the individual environments, each of whic
    5·1 answer
  • What are ya'll discords???
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!