Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <list>
- #include <time.h>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- int n = rand()%10 + 10;
- cout << n << endl;
- list<int> ls;
- for (int i = 0; i < n; i++)
- {
- ls.push_back(rand() % 1001);
- cout << ls.back() << " ";
- }
- ls.remove_if([](int n){
- return n > 500;
- });
- cout << endl << ls.size() << endl;
- for (list<int>::iterator it = ls.begin(); it != ls.end(); it++)
- cout << *it << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement