#include <iostream>
#include <list>
#include <numeric>
#include <algorithm>
using namespace std;
int main()
// create linked list of integers
list<int> the_list;
// input as requested
cout << " Enter length of the list " << endl;
size_t len;
cin >> len;
for(size_t i=0; i<len; ++i)
cout << " Enter value number " << i+1 << endl;
int tmp;
cin >> tmp;
// output
double sum = accumulate(the_list.begin(), the_list.end(), 0.0);
cout << " Arithmetic Mean is " << sum/the_list.size() << endl;
cout << " Maximum value is " << *max_element(the_list.begin(), the_list.end()) << endl;
cout << " Minimum value is " << *min_element(the_list.begin(), the_list.end()) << endl;

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

what's wrong with it to start with is the lack of code tags and formatting. Everything else is irrelevant as that means the code won't get read.

Hmm, it worked fine for me. Are you running from a command window or standalone? I added a pause at the end so that the standalone console app would not disappear after displaying the output.


Thx @tonymuilenburg
my code is worked now
i add the command u've given.

This question has already been answered. Start a new discussion instead.