Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <list>
- #include <algorithm>
- int main()
- {
- std::vector<int> arr{1,2,3,4,5,6,7,8,9,10};
- std::list<char> symbols{'a','s','d','a','s','x','v'};
- /*auto it{ arr.begin() };
- while ((it = std::find(it, arr.end(), 1)) != arr.end())
- {
- std::cout << "res is: " << std::distance(arr.begin(), it) << " <=> " << *it << '\n';
- ++it;
- }*/
- std::copy(arr.begin(), arr.end(), std::ostream_iterator<int>(std::cout, " ")); std::cout << '\n';
- std::cout << '\n';
- std::stable_partition(arr.begin(), arr.end(), [](int el) { return el % 2; });
- std::copy(arr.begin(), arr.end(), std::ostream_iterator<int>(std::cout, " ")); std::cout << '\n';
- std::cout << '\n';
- //auto res{ std::find(arr.begin(), arr.end(), 0)};
- //auto res{ std::count_if(arr.begin(), arr.end(),[](int el) { return (el % 2 == 0) and (el > 5); }) };
- /*if (res != arr.end())
- {
- std::cout << "res is: " << std::distance(arr.begin(), res) << " <=> " << *res << '\n';
- }
- else
- {
- std::cout << "Not FOUND!!\n";
- }*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment