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
pashok25 [27]
3 years ago
8

Write a program that first gets a list of integers from input. Then, get another value from the input, and output all integers l

ess than or equal to that value. If the input is 5 50 60 140 200 75 100, the output is: 50 60 75.
Computers and Technology
1 answer:
jonny [76]3 years ago
5 0

Answer:

The c++ program for the given scenario is given below.

#include <iostream>

using namespace std;

int main() {

   int len=20, arr[len], data;    

   // initialize all elements of the array to 0

   for(int i=0; i<len; i++)

   {

       arr[i] = 0;

   }    

   cout<<"This program outputs all the numbers less than or equal to the given number."<<endl;

   cout<<"Enter the list of numbers. Enter 0 to stop entering the numbers. "<<endl;

   for(int i=0; i<len; i++)

   {

       cin>>arr[i];        

       // 0 indicates user wishes to stop entering values  

       if(arr[i] == 0)

           break;

       else

           continue;

   }    

   // number from which the list is to be compared

   cout<<"Enter the number to be compared."<<endl;

   cin>>data;

     

   cout<<"The values less than or equal to the number "<<data<<" are "<<endl;

   for(int i=0; i<len; i++)

   {  

       // 0 indicates the end of the list entered by the user

       if(arr[i]==0)

           break;

       if(arr[i] <= data)

           cout<<arr[i]<<endl;

   }    

   return 0;    

}  

OUTPUT

This program outputs all the numbers less than or equal to the given number.

Enter the list of numbers. Enter 0 to stop entering the numbers.  

23

45

67

89

10

0

Enter the number to be compared.

59

The values less than or equal to the number 59 are  

23

45

10

Explanation:

This program takes input only from the user and makes no assumptions.

The list of numbers entered by the user are stored in an array. If the user input is less than the size of the array, the remaining elements are set to 0.

While taking input from the user, if any element of the array is found to be 0, the loop is discontinued.

for(int i=0; i<len; i++)

   {

       cin>>arr[i];        

       if(arr[i] == 0)

           break;

       else

           continue;

   }  

Same test is applied when all the numbers less than the given number are displayed.

for(int i=0; i<len; i++)

   {  

        if(arr[i]==0)

           break;

       if(arr[i] <= data)

           cout<<arr[i]<<endl;

   }

The above program takes into account all the specifications in the given question.

You might be interested in
Ben chang noticed that his store was lagging in sales . He realized that his staff was not experienced enough . As the store man
dem82 [27]
Ben should set up a program to teach his staff about customer service, and communicating with clients. 
4 0
3 years ago
Read 2 more answers
Four-pair UTP uses ________ connectors a)snap b)ST or SC c)None of these
Oliga [24]

Explanation & answer:

Four pair UTP (unshielded twisted pair) cables are common cables with RJ45 connectors.  Most RJ45 connectors have a snap to lock the male connector in place.

ST and SC connectors are for fibre-optics.

4 0
3 years ago
When a program terminates because a thrown exception is not handled, the program:
castortr0y [4]

Answer:

Option (e)

Explanation:

Option (e) is the answer. It indicates the exception thrown and displays it. It also indicates the place where the exception was thrown ( at what line of the code the exception was thrown )

Option (a) is false as the program which was terminated because of an exception which was not handled doesn't starts automatically.

Option (b) is false as it doesn't opens a dialogue box about running the program another time or anything. It just terminates because of the unhandled exception.

Option (c) is false as it doesn't saves all the output to a disk file called the "runStackTrace.txt".

Option (d) is false as it doesn't open a dialogue box. The program terminates because of the unhandled exception.

4 0
3 years ago
Tyrell is required to find current information on the effects of global warming. Which website could he potentially cite as a cr
Katarina [22]

Answer:

2345

Explanation:

5 0
2 years ago
Read 2 more answers
The it components of an erp system architecture include the hardware, software and the ________
natta225 [31]

The components of an ERP system architecture is made up of the hardware, software and the Data.

<h3>What is an ERP system?</h3>

Enterprise resource planning (ERP) is known to be a kind of  software that firms often use to handle or manage day-to-day business works such as accounting and others.

Note that The components of an ERP system architecture is made up of the hardware, software and the Data.

Learn more about  ERP system from

brainly.com/question/14635097

#SPJ12

6 0
2 years ago
Other questions:
  • A web page created expressly in hopes of ranking well for a term in a search engine's organic/non-paid listings and which itself
    7·1 answer
  • There are several vehicles in a parking lot. Some of them are motorcycles
    8·2 answers
  • Populate a one-dimensional array with the following grades in this order: 90, 61, 74, 42, 83, 51, 71, 83, 98, 87, 94, 68, 44, an
    15·1 answer
  • Which of the following are types of home internet service? Check all that apply
    7·1 answer
  • Write a Python program calculate summary statistics about a class assignment. First, prompt the user for the number scores to be
    6·1 answer
  • Do word provides an undo button that can be used to cancel the most recent command or action
    13·1 answer
  • I had tried to turn on Linux on the Chromebook but it's not working
    11·2 answers
  • Which of the following is a database concept that allows for storage and analysis for a dozen to billions of data points?
    7·1 answer
  • PYTHON HW PLEASE HELP. I NEED THE ACTUAL CODE!!! 100 POINTS AND BRAINLIEST. REPORTING IF YOU DON'T ANSWER
    11·1 answer
  • What is output by the following code?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!