Can someone please write an application of fillioning questi

Can someone please write an application of fillioning question in C++ and please use comments to explain line of codes used so I can better understand.

Write a C++ application that asks the user to enter 10 numbers. The program then stores those numbers. The program should display the numbers sorted from low to high, from high to low, the Mean , Median, and Mode.

Do this using both sort examples

Solution

#include #include #include #include using namespace std; int main() { double value, sum; double average, minimum=(int)INFINITY, maximum=-(int)INFINITY, median; mapmodes; vectordata; int count,mxmode=0; // initialise sum = 0.0; count = 0; cout << \"Enter a value: \"; while (cin >> value) { // process value sum += value; count++; if (value > maximum) maximum = value; else if (value < minimum) minimum = value; modes[ value ]++; mxmode = max(mxmode, modes[value]); data.push_back(value); // get next value cout << \"Enter a value: \"; } if (count == 0) cout << \"No data entry\" << endl; else { average = sum / count; sort(data.begin(), data.end()); if(data.size()%2==0) median = ( data[ data.size()/2 - 1 ] + data[ data.size()/2 ] )/2.0; else median = data[ data.size()/2 ]; cout << \"There were \" << count << \" numbers\" << endl; cout << \"Average was \" << average << endl; cout << \"Minimum was \" << minimum << endl; cout << \"Maximum was \" << maximum << endl; cout << \"Median was \" << median << endl; cout << \"Median was\"; for (auto &x: modes) if(x.second == mxmode) cout<<\" \"<
Can someone please write an application of fillioning question in C++ and please use comments to explain line of codes used so I can better understand. Write a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site