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
Harvey is not happy with the software that allows the programmer to write and run code and wants to find something new. If Harve
Assoli18 [71]

Answer:

D. integrated development environment

Explanation:

Given that an integrated development environment is a form of computer software App that allows the users or programmers to develop a software App in a way the enables them to carry out different operations including source code development, build and test automation, and debugging activities.

For example NetBeans, Eclipse, IntelliJ, and Visual Studio.

Hence, in this case, the correct answer is "integrated development environment."

3 0
3 years ago
Which of the following would allow for the QUICKEST restoration of a server into a warm recovery site in a case in which server
adelina 88 [10]

Answer: C. Differential backup

Explanation: There are several ways od ensuring the preservation and storage of data even cases of disaster, one of such ways is data data mirroring which allows data to be replicated or copied in real time and several backup options. In cases where there there is need to restore a server, the warm recovery site provides a data or disaster recovery option used to mitigate the effect of data loss on organization. In the absence of data mirroring, differential backup option, provides the quickest recovery option as it only requires changes in the data stored after the last full backup. These speed experieced should be expected due to the relatively low data been dealt with rather than the entire data.

5 0
3 years ago
Why did artists use pinhole cameras during the renaissance?
Dima020 [189]
Pinhole cameras were one of the most sophisticated devices of the period, it made tasks much easier it basically worked exactly like the human eye and is something just like tracing.
8 0
3 years ago
I got a kahoot! Totally random pls join!<br><br> Code 08408519!
OlgaM077 [116]

Answer:

say less

Explanation:

5 0
3 years ago
Read 2 more answers
The following code would include _______.
julia-pushkina [17]

Answer:

Option d is the correct answer for the above question

Explanation:

  • The above question asked about the result of the above question code, which has the query of two tables and their primary key is matched in the where class.
  • The Customer_T table has a primary key "CustomerID" and the Order_T has a foreign key "Customer_ID" and that both are matched in the where clause.
  • So the above query fetches that result in which the records match both the table. Hence Option d is the correct answer for the above question while the other is not because another option is not to get by the result of the above query.
8 0
3 years ago
Other questions:
  • Normal view
    10·2 answers
  • How is sharepoint used in organization today?
    12·1 answer
  • Calls to the tostring( ) method emphasize the use of ____.
    12·1 answer
  • ___ is a career discipline focusing on helping companies use computer technology effectively.
    12·1 answer
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • If you have long column labels with columns so wide that they affect the readability of a worksheet you should first
    6·2 answers
  • What is the best brand of folders
    13·2 answers
  • Many major employers routinely monitor the performance of their employees through the computers and telephones they use. Employe
    12·1 answer
  • Free points,
    15·2 answers
  • Suggest three ways in which celebrating an occasion influences food choices?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!