#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;
the_list.push_back(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;
}
kneel -2 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
jwenting 1,889 duckman Team Colleague
tonymuilenburg -2 Light Poster
kneel -2 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.