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
Which feature of Microsoft power point allowed you to put a picture in every slide
nasty-shy [4]

Click where you want to insert the picture on the slide.

On the Insert tab, in the Images group, click Pictures.

In the dialog box that opens, browse to the picture that you want to insert, click that picture, and then click Insert.

3 0
3 years ago
Were is the hype house
balandron [24]

Answer:

LA

Explanation:

where the rich people live

8 0
3 years ago
Read 2 more answers
Arrange the steps involved in natural language generation.
Firdavs [7]

Answer:

1. accessing content from some knowledge base.

2. picking words and connecting them to form sentences.

3. setting the tone and style of the sentence.

4. mapping the sentence plan into sentence structure.

Explanation:

Natural language generation can be defined as a part of artificial intelligence (AI) which typically involves developing responses by an AI in order to enable the computer engage in a useful conversation.

This ultimately implies that, the computer has to generate meaningful data (phrases and sentences) from the internal database.

Basically, the steps involved in natural language generation in a chronological order are listed below;

1. Text planning: accessing content from some knowledge base.

2. Picking words and connecting them to form sentences

3. Sentence planning: setting the tone and style of the sentence.

4. Text realization: mapping the sentence plan into sentence structure.

4 0
3 years ago
The limitation of trade secret protection for software is that it is difficult to prevent the ideas in the work from falling int
Lubov Fominskaja [6]

Answer:

The answer is "Option B".  

Explanation:

The main drawback of commercial security is, that the software may not protect digital technology against data mining, and they are not known to be the  imperial tools, that's why the only option B is correct, and certain options are wrong, which can be explained as follows:

  • In option A, It used to provide a sequence of instructions, which is used in security.  
  • In option C, It doesn't use in security, that's why it is wrong.
  • Option D and Option E are wrong because in software there is no use of court and new software, it only upgrades the software.
4 0
3 years ago
Do you watch markiplier?
ki77a [65]

Answer: Yes

Explanation: He is cool

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that prints the numbers 1 to 4 on the sameline with each pair of adjacent numbers separated by a single space(1
    5·1 answer
  • Because it takes time to change an organization’s culture, the ISO must continually monitor security policy compliance. The ISO
    9·1 answer
  • Given n ropes of different lengths, we need to connect these ropes into one rope. We can connect only 2 ropes at a time. The cos
    9·1 answer
  • What is the difference between the Internet and the World Wide Web? Explain in your own words.
    13·2 answers
  • If there is only a stop sign posted at a railroad
    9·1 answer
  • In java please
    13·1 answer
  • Project manager Kevin has to create a project team organizational chart. Which activity should he perform before creating this c
    9·1 answer
  • Simple example of hybrid computer​
    7·2 answers
  • Write a description of the photograph to someone who cannot see the photograph. Be sure to include the title of the photograph a
    5·1 answer
  • What is the full form of MOS<br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!