Program Lab #6 Arrays You have been asked to construct a program, making extensi
ID: 3640251 • Letter: P
Question
Program Lab #6Arrays
You have been asked to construct a program, making extensive use of functions, that will perform computations on a group of numbers.
Create a program that prompts the user to enter 10 numbers, each separated by a space. The program will find the smallest, largest,
sum, and average of the numbers.
=================================================================================================================================
Deliverables:
Write a program using good style, indents, descriptive variable names, comments, etc..
Greet the user and provide a few lines about what the program is/does.
Prompt the user to enter 10 numbers each separated by a space.
Echo the numbers back to the user after they are entered.
Determine the smallest number, largest number, the sum of the numbers and the average of the numbers.
Print the smallest, largest, sum and average of the numbers.
=================================================================================================================================
You should write six (6) functions according to the following descriptions:
The function Instruct should have no formal parameters and no return value, but describes the use and the purpose of the program.
The function GetNumbers should have an integer array as its formal parameter, and should fill the array with values from the user.
The function FindLargest should have an integer array as its formal parameter, and should return the largest value in the array.
The function FindSmallest should have an integer array as its formal parameter, and should return the smallest value in the array.
findSmallest has two arguments and returns the smallest of these two numbers.
The function Sum should have and integer array as its formal parameter. It should compute the sum of all the numbers in the array
and return the value as an integer.
The function Output should take as input parameters the largest and smallest values and the sum and average. It need not return
a value and should output the appropriate values as shown below.
Note: All input values are of type int, but the average should be of type float so be sure you compute the values.
=================================================================================================================================
Example Output:
This program will determine the largest and smallest values in a set of ten numbers.
It will also compute the sum and average of the numbers.
Please enter your list of ten numbers: 10 5 3 -5 9 14 -8 0 2 -6
Your array has these values:
10 5 3 -5 9 14 -8 0 2 -6
From your list of 10 numbers:
Smallest: -8
Largest: 14
Sum: 24
Average: 2.4
Explanation / Answer
#include using namespace std; void Instruct(void); void GetNumbers(int *); int FindLargest(int *); int FindSmallest(int *); int Sum(int *); void Output(int , int , int , float); int main() { int a[10]; int largest,smallest,total,average; Instruct(); GetNumbers(a); largest = FindLargest(a); smallest = FindSmallest(a); total = Sum(a); average = sum*1.0/10; Output(largest, smallest, total, average); return 0; } void Instruct(void) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.