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
REAL ANSWERS ONLY!!! BRAINLLIEST AND 50 POINTS FOR BEST ANSWER
BigorU [14]
I’m not sure what you’re asking, what about a presentation? Reply back to this and lmk so I can figure it out for ya!!
6 0
3 years ago
Read 2 more answers
Full form of SMPT???
Anna11 [10]

Answer:

Simple Mail Transfer Protocol (SMTP) is the standard protocol for sending emails across the Internet.

5 0
3 years ago
What are the benefits of PowerPoint
Leto [7]
I guess you could say it offers a easier and faster way to facilitate the spread of information through visual displaying of the said information.
5 0
3 years ago
Read 2 more answers
Which information medium is used to access information from the Internet in the form of HTML pages?
enyata [817]

Answer:D

Explanation:

4 0
4 years ago
Which type of attack cripples the network and prevents legitimate users from accessing network resources
yaroslaw [1]

Answer:

A Distributed Denial of Service (DDoS) attack is a non-intrusive internet attack made to take down the targeted website or slow it down by flooding the network, server or application with fake traffic. When against a vulnerable resource-intensive endpoint, even a tiny amount of traffic is enough for the attack to succeed.

Distributed Denial of Service (DDoS) attacks are threats that website owners must familiarize themselves with as they are a critical piece of the security landscape. Navigating the various types of DDoS attacks can be challenging and time consuming. To help you understand what a DDoS attack is and how to prevent it, we have written the following guidelines.

1

What is a DDoS attack?

1.1 – Understanding a DDoS Attack

The objective of a DDoS attack is to prevent legitimate users from accessing your website. For a DDoS attack to be successful, the attacker needs to send more requests than the victim server can handle. Another way successful attacks occur is when the attacker sends bogus requests.

1.2 – What is the Goal Behind a DDoS Attack?

The main goal of an attacker that is leveraging a Denial of Service (DoS) attack method is to disrupt a website availability:

The website can become slow to respond to legitimate requests.

The website can be disabled entirely, making it impossible for legitimate users to access it.

6 0
3 years ago
Other questions:
  • Technological _____ is the term used to describe the merging of several technologies into a single device.
    13·1 answer
  • True or false: a cover letter accompanies a resume to showcase a job-seeker’s personal life
    6·2 answers
  • After saving her presentation initially, Leah realizes she needs to add another content slide. She adds the slide and is ready t
    7·1 answer
  • In ssl/tls, a specific set of protocols that a particular cryptographic system will use to provide protection is called a ______
    5·1 answer
  • What are the best 3 xbox 360 games ?​
    10·2 answers
  • File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then
    8·1 answer
  • What is the gauge manifold made of
    14·1 answer
  • how do I delete my brainly account, my child signed up for it and nothing has been paid but I do not want the account to exist a
    7·2 answers
  • For this assignment your are to implement the Pet Class described in Programming Exercise 1, starting on page 494 in our textboo
    6·1 answer
  • Can somebody tell me the Minecraft command to clear an entire world and destroy every block if u Dunno please don’t answer &gt;-
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!