#include <iostream>
#include <algorithm>
#include <list>
int main()
{
std::list<int> lst;
for (int i = 10; i <= 30; i += 2) {
lst.push_back(i);
}
for (auto elem : lst) {
std::cout << elem << ' ';
}
std::cout << std::endl;
auto indexvalue16 = find(lst.begin(), lst.end(), 16);
if (lst.end() == indexvalue16)
{
std::cout << "item not found" << std::endl;
}
else
{
std::cout << "item found" << std::endl;
}
reverse(lst.begin(), lst.end());
for (auto elem : lst) {
std::cout << elem << ' ';
}
std::cout << std::endl;
std::cout << "max: " << *max_element(lst.begin(), lst.end()) << std::endl;
std::cout << "min: " << *min_element(lst.begin(), lst.end()) << std::endl;
std::cout << std::endl;
return 0;
}
/*
run:
10 12 14 16 18 20 22 24 26 28 30
item found
30 28 26 24 22 20 18 16 14 12 10
max: 30
min: 10
*/