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
Lera25 [3.4K]
3 years ago
5

Write a program that gets a list of integers from a user. First, the user should be asked to enter the number of integers to be

stored in a list. Then your program should ask for these integers and store them in the list. Finally, the program should ask the user to enter a sentinel value that will be used to search through the integers in the list which are greater than the sentinel value. For example: If the input is: 7 50 60 140 200 75 100 172 70 the output is: 140 200 75 100 172 The 7 indicates that there are seven integers in the list, namely 50 60 140 200 75 100 172. The 70 indicates that the program should output all integers greater than 70, so the program outputs 140 200 75 100 172. You should use methods in addition to the main method. getListValues to get and store the values from the user printListValuesGreaterThanSentinal to print the values found to be greater than the sentinel value.
Computers and Technology
1 answer:
Leviafan [203]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

void insert(int *arr, int num);

int n;

void returnGT(int arr[]);

int main(){

   cout<< "Enter the number of integers: "<<endl;

   cin>>n;

   int num[n];

   insert(num, n);

   returnGT(num);

}

void insert(int *arr, int num){

   for (int i = 0; i < num; i++){

       cout<< "Enter item "<< i + 1 << " : ";

       cin>> arr[i];

   }

}

void returnGT(int arr[]){

   int sentinel;

   cout<< "Enter sentinel: ";

   cin>> sentinel;

   for (int i = 0; i < n; i++){

       if (arr[i] > sentinel){

           cout<< arr[i] << " ";

       }

   }

}

Explanation:

The C++ source code defines an array of integer values, the program prompts for user input for the array size and the sentinel value to fill the array with input values and output integer values greater than the sentinel.

You might be interested in
What is indirect recursion?
marshall27 [118]
Most basic examples of recursion, and most of the examples presented here, demonstrate direct recursion, in which a function calls itself. Indirect recursion occurs when a function is called not by itself but by another function that it called (either directly or indirectly). For example, if f calls f, that is direct recursion, but if f calls g which calls f, then that is indirect recursion of f. Chains of three or more functions are possible; for example, function 1 calls function 2, function 2 calls function 3, and function 3 calls function 1 again.

Indirect recursion is also called mutual recursion, which is a more symmetric term, though this is simply a difference of emphasis, not a different notion. That is, if f calls g and then g calls f, which in turn calls g again, from the point of view of f alone, f is indirectly recursing, while from the point of view of g alone, it is indirectly recursing, while from the point of view of both, f and g are mutually recursing on each other. Similarly a set of three or more functions that call each other can be called a set of mutually recursive functions.
3 0
3 years ago
How many typefaces should you use in business documents?
Assoli18 [71]
It’s best to use two
5 0
3 years ago
Read 2 more answers
Kevin is working on a financial project that involves a lot of statistical information. He needs software that allows him to ent
makvit [3.9K]

Answer: Spreadsheet Software

If Kevin would use a spreadsheet software, he will be able to input all of the statistical data and have the software generate graphs of the data that he has inputted into the spreadsheet. Using a spreadsheet software, Kevin will also have access to changing the graphs data whenever an anomaly has been detected.

Some of examples of these software would be:

  • Microsoft Excel
  • Open Office
  • Google Sheets
  • LibreOffice

8 0
3 years ago
Anyone trying to play?
Lunna [17]

Answer:

no

Explanation:

7 0
3 years ago
Read 2 more answers
Please help .........​
Verdich [7]

Answer:

I don't think brainly can help on this one chief I think you will have to research the topic and write about it yourself. or just write 3 facts and put spaces until you reach the limit.

3 0
3 years ago
Other questions:
  • Rebecca completed work on a computer and is verifying the functionality of the system when she finds a new problem. This problem
    13·1 answer
  • HURRRYY After pasting the information on the left side of the comparison slide, Jamal notices the text box extends beyond the bo
    9·1 answer
  • Give two reasons why it is important to upgrade your browser when a new version becomes available.
    8·1 answer
  • The component that allows you to make a paper-based copy of a body of text is the _____.
    12·1 answer
  • Which method would provide you with pictures you could upload from a disc that you insert in your computer?
    8·1 answer
  • How would you define media literacy?
    12·1 answer
  • Logical address is generated by,
    13·1 answer
  • Can any one help me please with my computer science hwk :)
    11·1 answer
  • Select the correct answer.
    11·2 answers
  • A(n) __________ looks and acts just like a publicly accessible website and uses the same software, hardware, and networking tech
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!