Question: Hello, I need help solving this Lab simulation, It uses Elements in a range for vectors statements and I am very new at coding on

Hello, I need help solving this Lab simulation, It uses Elements in a range for vectors statements and I am very new at coding on so I need help solving it. It is very difficult. It is very confusing since the there are multiple inputs and can only code one input in the simulation.

a program that first gets a list of integers from input (the first integer indicates the number of integers that follow). That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a space, even the last one. If the input is:

5 25 51 0 200 33 0 50 

then the output is:

25 0 33 

(the bounds are 0-50, so 51 and 200 are out of range and thus not output).

To achieve the above, first read the list of integers into a vector.

#include

#include

using namespace std;

int main() {

/* your code here. */

return 0;

}

Here is a hint my friend gave to me:

#include

#include

usingnamespacestd;

intmain() {

//declare userNums as type vector

//declare numValues of type integer

//declare lowerBound of type integer

//declare upperBound of type integer

//declare i of type integer

//declare userInput of type integer

cout<<"Enter the number of integers you will be inputting"<

//capture numValues from keyboad

cout<<"Enter "<

for(jQuery22403861679052989979_1591068153883; i < ??; ??) {//start a for loop and cycle through the loop numValues times

//capture userInput from keyboard

//use push_back function to insert captured value into the vector

}

cout <<"Enter lower bound"<

//capture lowerBound

cout<<"Enter upper bound"<

//capture upperBound

cout <<"Here are the numbers within the range of "<

for(??; ??; ??) {//start a for loop and cycle through the loop numValues times

if(?? && ??) {//check if the userNum at location i is >= lowerBound and usernum at location i is <= upperBound

// print userNums at location i

}

}

cout << endl;

return0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!