Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
list
//Title of this code #include <iostream> #include <list> using namespace std; void printList(list<int>& l) { for (auto it = l.begin(); it != l.end(); ++it) cout << *it << " "; cout << endl; } int main() { list<int> l1, l2, l3; l1.push_back(11); l1.push_back(2); l1.push_back(1); l1.push_back(12); l1.push_back(3); l2.push_back(6); l2.push_back(7); l2.push_back(9); l2.push_back(10); l1.sort(); l2.sort(); printList(l1); printList(l2); auto p = l2.begin(); for (auto it = l1.begin(); it != l1.end(); ++it) { if (*it > *p) { l1.splice(it, l2); break; } } int x = 8; for (auto it = l1.begin(); it != l1.end(); ++it) { if (*it > x) { l1.insert(it, x); break; } } printList(l1); printList(l2); l2.merge(l1); printList(l2); std::cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
1068 - Investigation
Varadic macro
runtime template mode processor
weird cast in qt moc files
LRU cache
Exempel 2
多态
sheetal
Proyecto 1
PayTax