Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program containing 4 seperate C++ functions to perform the following on

ID: 3622531 • Letter: W

Question

Write a program containing 4 seperate C++ functions to perform the following on a one dimensional integer array called "LIST". (The array is populated with N random numbers):
1. Determine the highest value
2. Determine the lowest value
3. Determine the sum of all the items in LIST
4. Determine the average of the values, after eliminating the lowest and highest values. (this function should invoke some or all of the other 3 functions.)

*the user should be prompted to input N for the amount of random numbers to populate the array with.

Explanation / Answer

//Header file section
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
  const int size = 100;
  int small,large;
  int numberArray[size];
 //Inputting elements of array
 cout<<"Enter random Values of array :"<<endl;

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

 {
 cin>>numberArray[i];
}
//Assigning starting element to small,large
small=numberArray[0];
large=numberArray[0];

//Logic to find highest and lowest
for(int j=0;j<size;j++){
if(numberArray[j] >large)
large = numberArray[j];
if(numberArray[j] < small )

small = numberArray[j];
}
// Displaying the highestand lowest values.

cout<<" The lowest value is:"<<small<<endl;

 cout<<" The highest value is :"<<largest<<endl;
//To pause system for a while
system("pause");

return 0;
}
//End main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote