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
Select the correct answer.
Galina-37 [17]
Functional languages
8 0
2 years ago
President Roosevelt's Fireside Chats were:
larisa86 [58]
C. Entertaining radio shows that families listened to in the evening. He did these chats to inform the public on what he was going to do about the problems facing the public.
3 0
2 years ago
Read 2 more answers
Consider two different implementations of the same instruction set architecture (ISA). The instructions can be divided into four
PSYCHO15rus [73]

Answer: Find answers in the attachments

Explanation:

3 0
3 years ago
You are the network administrator for a small organization of 100 users. Users till now were freely browsing the Internet. You w
Schach [20]

Answer: Proxy server

Explanation: Proxy server is a type of server that is acts as interface between the network on huge scale and any local network. This server provides the feature of security, operations, privacy etc in the network system. They also help in improving the performance of the network.

It can work as the web filter to eliminate the unwanted websites.They acts as the gateway by  observing the website that is being browsed by the other user.Thus installation of proxy server should implemented on the organization.

8 0
3 years ago
Assume your sketch has a variable named silo, which stores an object that is defined by a class you have created. The name of th
yulyashka [42]

Answer:

c. let v = silo.volume();

Explanation:

When you create and initialize a new object you pass through that object's class constructor. The constructor is in charge of initializing all the necessary variables for that class including radius and height. Once you save the object in a specific variable (silo) you need to call the class methods through that variable, using the '.' command. Therefore, in this scenario, in order to call the volume() method you would need to call it from the silo object and save it to the v variable, using the following statement.

let v = silo.volume();

7 0
2 years ago
Other questions:
  • Having a good credit score is important because:
    7·1 answer
  • Misperceptions can lead to miscommunication. List an example from the article.(site 1)
    10·2 answers
  • How are IP addresses usually written?
    7·1 answer
  • Which is said to be ‘computer on a chip’ (a) Micro processors (b) Microcontrollers (c) Both (c) None of the above
    9·1 answer
  • Which type of image format is constructed using proportional formulas rather than pixels? This task contains the radio buttons a
    12·2 answers
  • How are computers used in education and entertainment? List them.​
    10·1 answer
  • Dr. Wayne is trying to developing techniques to cure Parkinson’s disease by inserting genetic material into patients’ cells to c
    12·1 answer
  • A user finished working on a computer in the lab. What should the user do so
    15·1 answer
  • 4.7 Code Practice: Question 2
    7·1 answer
  • What the difference between an operating system drive and a storage drive?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!