Write a void function that prints the list of nonnegative integers in reverse. Write a void function that prints all the numbers stored in the list that are greater than 10. It will also print the number of such numbers found. Write a function that determines the largest value stored in the array and returns that value to the calling function main. Write a function that determines the number of even integers stored in the array and returns that value to the calling function main. Write a function that calculates the average of the values stored in the array and returns that value. to the calling function main. Write the function calls with the appropriate arguments in the function main. Any values returned will be output. Write appropriate block comments for each function header similar to the ones provided. Show your understanding of the program and thus provide useful information to the reader. Test all the functions using appropriate test data. Use the following code and edit it where needed. #include //for cin, cout using namespace std; const int MAX_SIZE = 20; // maximum size of array //function prototypes void ReadList(int[], int&);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a void function that prints the list of nonnegative integers in reverse.

Write a void function that prints all the numbers stored in the list that are greater than 10. It will also print the number of such numbers found.

Write a function that determines the largest value stored in the array and returns that value to the calling function main.

Write a function that determines the number of even integers stored in the array and returns that value to the calling function main.

Write a function that calculates the average of the values stored in the array and returns that value. to the calling function main.

Write the function calls with the appropriate arguments in the function main. Any values returned will be output.

Write appropriate block comments for each function header similar to the ones provided. Show your understanding of the program and thus provide useful information to the reader.

Test all the functions using appropriate test data.

Use the following code and edit it where needed.

#include <iostream> //for cin, cout

using namespace std;

const int MAX_SIZE = 20; // maximum size of array
//function prototypes
void ReadList(int[], int&);
void PrintList(const int[], int);

 

int main()
{
int list[MAX_SIZE]; // array of nonnegative integers
int numberOfIntegers = 0; // number of nonnegative integers in array

ReadList(list, numberOfIntegers);
PrintList(list, numberOfIntegers);
//output your name etc.
cout << "123\n\n";

system("pause");
return 0;
}

 

//***************************************************************************
// Definition of function ReadList.
// This function reads nonnegative integers from the keyboard into an array.
// The parameter list is an array to hold nonnegative integers read.
//The parameter length is a reference parameter to an int. It holds the
// number of nonnegative integers read.
//***************************************************************************

void ReadList(int list[], int& length)
{
int number;
int index = 0;
cout << "\n\nEnter nonnegative integers each separated by a blank space,\n"
<< " and mark the end of the list with a negative number: ";

cin >> number; //read the first integer entered

//check that the number is nonnegative and
// the size of the array is not exceeded


while (number >= 0 && index < MAX_SIZE)
{
list[index] = number; //store the integer in the array
index++; // increment the index
cin >> number; // read the next integer
}

length = index; // length is the number of nonnegative integers
// in the list
}


//***************************************************************************
// Definition of function PrintList.
// The function prints the nonnegative integers in the array list and the
// number of integers in the array.
// The parameter list holds the nonnegative integers
// The parameter length holds thenumber of nonnegative integers.
//***************************************************************************


void PrintList(const int list[], int length)
{
int index;
cout << "\nThe list contains " << length
<< " nonnegative integer(s) as follows: \n";

for (index = 0; index < length; index++)
cout << list[index] << " ";
cout << endl;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education