#include #include using namespace std; int main(void) { list ahel; ahel.push_back(0); ahel.push_front(7); ahel.insert(++ahel.begin(),2); //Pärast esimest elementi ahel.push_back(5); ahel.push_back(6); list::iterator i; for(i=ahel.begin(); i != ahel.end(); ++i){cout << *i << " ";} cout << endl; ahel.sort(); for(i=ahel.begin(); i != ahel.end(); ++i){cout << *i << " ";} cout << endl; cout << "Viimane: " << ahel.back() << endl; ahel.pop_back(); cout << "Viimane: " << ahel.back() << endl; cout << "Esimene: " << ahel.front() << endl; ahel.pop_front(); cout << "Elementide arv " << ahel.size() << endl; for(i=ahel.begin(); i != ahel.end(); ++i){cout << *i << " ";} cout << endl; return 0; } /* [jaagup@minitorn c]$ ./a.out 7 2 0 5 6 0 2 5 6 7 Viimane: 7 Viimane: 6 Esimene: 0 Elementide arv 3 2 5 6 */