I am trying to write a C++ code that will Prompt the user with the following men
ID: 3622569 • Letter: I
Question
I am trying to write a C++ code that will Prompt the user with the following menu:1. Return highest value
2. Return lowest value
3. Determine the sum
4. Return the average of the values, after eliminating the lowest and highest values
-Each selection should return its corresponding value by calling on a function
-I have already gotten most of the program done, but I am having difficulty accessing the values, rather than the placeholder. Please see my attached code.
-The values are taken from a randomly populated array called list which I have already written code for.
//Header file section
#include<iostream>
using namespace std;
int *LIST;
int SIZE=0;
int n=0;
int main()
{
int small,large;
cout<<"Enter the number of elements: " << endl;
cin >> SIZE;
LIST = new int[SIZE];
cout << "the list is as follows: " << endl;
cout << endl;
for (int i=0;i<SIZE;i++)
{
LIST[i]=i;
cout << "Array[" << n++ << "]= " << rand() << endl;
}
//Assigning starting element to small,large
small=LIST[0];
large=LIST[0];
//Logic to find highest and lowest
for(int j=0;j<SIZE;j++)
{
if(LIST[j] >large)
large = LIST[j];
if(LIST[j] < small )
small = LIST[j];
}
// Displaying the highestand lowest values.
cout<<" The lowest value is:"<<small<<endl;
cout<<" The highest value is :"<<large<<endl;
return 0;
}
//End main
Explanation / Answer
This is a program to find the maximum and minimum of given list. #include using namespace std; int main(){ int n,i,fmax[100]; int max=-999,maxindex=-1,min=9999,minindex=-1; coutn; for(i=0;i>fmax[i]; if( fmax[i]>max ){ max = fmax[i]; maxindex = i+1; } if ( fmax[i]Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.