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
Now plz<br>draw the main memory​
Sophie [7]

Answer: Here is my answer- I hope it helps! Btw I did search this up but I change some words so I don't get in trouble again ; - ;

Explanation: A unit of measurement is a definite importance of an amount, defined and adopted by convention or by law, that is used as a standard for measurement of the same kind of amount. Any other amount of that kind can be expressed as a multiple of the unit of measurement. For example, a length is a physical amount.

3 0
2 years ago
Who goes to belle place middle and is in 7th grade on hear​
SashulF [63]

Answer:

Not me but thx for the free points lol

Explanation:

3 0
3 years ago
How can you know if the information is based on scientifically collected data and if it's corroborated by other sources? Follow
Radda [10]

The links redirect the reader to other PETA articles.

Answer: Option A.

<u>Explanation:</u>

A link (short for hyperlink) is a HTML object that permits you to bounce to another area when you snap or tap it. Connections are found on pretty much every site page and give a basic methods for exploring between pages on the web. Connections can be joined to content, pictures, or other HTML components.

A link is a reference to information that the peruser can follow by clicking or tapping. A hyperlink focuses to an entire archive or to a particular component inside a record. Hypertext is content with hyperlinks. The content that is connected from is called stay content.

5 0
3 years ago
Read 2 more answers
Which of the following enabled mass production in the 1920s? a.standardization of spare parts b.mass availability of electricity
forsale [732]
The mass production is a way of the production of large amount of standardized materials and good. The same goes for the production of  the spare parts. By the year 1920, most of the goods that are produced in large amount are spare parts of the vehicles. Thus, the answer is letter A. 
4 0
3 years ago
Read 2 more answers
Nancy is formatting a simple Webpage. Her supervisor has directed her to create headings before the second and fourth paragraphs
Natasha2012 [34]

Answer:

Paragraph-level elements.

Explanation:

When Nancy is formatting the webpage.She needs to create heading before the second and the fourth paragraphs.Nancy should paragraph level elements.

Specifically she should use heading tag .There are six heading tags from h1 tag to h6 tag h1 displays most important heading while h6 displays least important heading.

<h1> Heading </h1>.

6 0
2 years ago
Other questions:
  • Assume a 8x1 multiplexer’s data inputs have the following present values: i0=0, i1=0, i2=0, i3=0, i4=0, i5=1, i6=0, i7=0. What s
    8·1 answer
  • In Python please.
    13·1 answer
  • You may be guilty of plagiarism even if
    13·1 answer
  • 11 of the 25 people on the bus get off at the first stop. What percent best represents the portion of the bus that got off on th
    7·1 answer
  • Fuction table of JK-Flip flop?
    11·1 answer
  • An important communication principle states ""prepare before you communicate."" How should this preparation manifest itself in t
    10·1 answer
  • How many times do you return after the dateline ?
    12·1 answer
  • Assume that you have the business data in various sources such as Excel, .csv, text files and Access, Oracle databases. Write th
    9·1 answer
  • What is the best example of an interrogative sentence?
    12·2 answers
  • Intelligent computer uses _________ to learn.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!