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
Sidana [21]
2 years ago
9

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer

s 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. The output ends with a newline.
Ex: If the input is: 5 25 51 0 200 33
0 50

then the output is:
25 0 33
Computers and Technology
1 answer:
snow_tiger [21]2 years ago
3 0

Answer:

The program implemented in C++ is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

int lenlist;

vector<int> mylist;

cout<<"Length List: ";

cin>>lenlist;

mylist.push_back(lenlist);

int i =0; int num;

while(i<lenlist){

   cin>>num;

   mylist.push_back(num);  

   i++;

}

int min,max;

cout<<"Min: ";  cin>>min;

cout<<"Max: ";  cin>>max;

cout<<"Output!"<<endl;

for(int i=1; i < mylist.size(); i++){

  if(mylist.at(i)>=min && mylist.at(i)<=max){

      cout<<mylist.at(i)<<" ";

  }

}

  return 0;

}

Explanation:

This declares the length of the list as integer

int lenlist;

This declares an integer vector

vector<int> mylist;

This prompts user for length of the list

cout<<"Length List: ";

This gets input of length of the list from the user

cin>>lenlist;

This pushes user input to the vector

mylist.push_back(lenlist);

int i =0; int num;

The following iteration gets user inputs and pushes them into the vector

<em>while(i<lenlist){ </em>

<em>    cin>>num; </em>

<em>    mylist.push_back(num);  </em>

<em>    i++; </em>

<em>} </em>

This declares min and max variables

int min,max;

This prompts user for the lower bound

cout<<"Min: ";  cin>>min;

This prompts user for the upper bound

cout<<"Max: ";  cin>>max;

The following iteration checks for numbers within the lower and upper bound and print the numbers in that range

<em>cout<<"Output!"<<endl; </em>

<em>for(int i=1; i < mylist.size(); i++){ </em>

<em>   if(mylist.at(i)>=min && mylist.at(i)<=max){ </em>

<em>       cout<<mylist.at(i)<<" "; </em>

<em>   } </em>

<em>} </em>

You might be interested in
Need answer ASAP. No links
DIA [1.3K]

Answer:

A <b>

Normally AD and BC are written in bold letters.

for example : The terms anno Domini (AD) and before Christ (BC).

Within available option the best option to choose is <b> hope it helped

5 0
3 years ago
Which component of an email gives the recipient an idea of the email’s purpose and urgency?
Delvig [45]

Answer:

subject line

Explanation:

it is a brief description of what the email subject is.

4 0
2 years ago
Please complete the spelling please tell fast.​
LenaWriter [7]

Answer:

spacebar and number i think

Explanation:

5 0
3 years ago
Read 2 more answers
What did Bill Gates invent?
Viktor [21]
He invented microsoft.
8 0
3 years ago
Read 2 more answers
Which of the items below are nodes? fax, IC, NOC, printer, twisted pair cables and workstation.
RSB [31]

The answer is Printer, workstation, NOC, and fax.

Any devices or systems connected to a network are called nodes. When defining a node, always have in mind that it is anything that has an IP address. For instance, if a network connects 5 computers, 1 file server, and 2 printers, there are 8 nodes on this network.

3 0
3 years ago
Other questions:
  • What does BMP stand for?
    10·2 answers
  • What is faster a hi-speed usb port or superspeed usb port?
    13·1 answer
  • A red wavy line under a word means _____. a change has been made in the text a new word was inserted in the document there is a
    11·2 answers
  • The command-line interface tells a user that it's ready to receive commands by displaying a specific set of characters called a(
    12·1 answer
  • What are some example of popular music for teenagers
    8·2 answers
  • Select all of the reasons Windows 95 increased the popularity of Windows.
    12·1 answer
  • the ghost adventures team uses a variety of tools and technology in investigations. which one is described as an adjustable freq
    9·1 answer
  • DEFINE Problem:
    11·1 answer
  • 3 ways that can be used to connect computers to a network
    5·1 answer
  • Your network uses a network address of 137. 65. 0. 0 with a subnet mask of 255. 255. 0. 0. How many ip addresses are available t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!