Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Set Insert Operation
//Exploring Set Data Structure Insert Ops #include <iostream> #include <set> #include <vector> #include <utility> using namespace std; typedef set<int>ISet; typedef set<int>::iterator iIterator; typedef set<double>DSet; typedef set<double>::iterator dIterator; typedef set<double>::const_iterator cIterator; int main() { DSet dData; set<double>::const_iterator citer; pair<cIterator, bool>p1 = dData.insert(7.25); pair<cIterator, bool>p2 = dData.insert(1.75); pair<cIterator, bool>p3 = dData.insert(2.25); pair<cIterator, bool>p4 = dData.insert(3.55); pair<cIterator, bool>p5 = dData.insert(5.50); pair<cIterator, bool>p6 = dData.insert(4.25); pair<cIterator, bool>p7 = dData.insert(1.86); pair<cIterator, bool>p8 = dData.insert(7.25); pair<cIterator, bool>p9 = dData.insert(0.25); pair<cIterator, bool>p10 = dData.insert(1.86); pair<cIterator, bool>p11 = dData.insert(9.25); pair<cIterator, bool>p12 = dData.insert(10.25); if(p3.second == 0) cout << "\n" << *p3.first << " Not Inserted.\tDuplicate\n"; else cout << "\n" << *p3.first << " Inserted.\n"; if(p6.second == 0) cout << "\n" << *p6.first << " Not Inserted.\tDuplicate\n"; else cout << "\n" << *p6.first << " Inserted.\n"; if(p8.second == 0) cout << "\n" << *p8.first << " Not Inserted.\tDuplicate\n"; else cout << "\n" << *p8.first << " Inserted.\n"; if(p11.second == 0) cout << "\n" << *p11.first << " Not Inserted.\tDuplicate\n"; else cout << "\n" << *p11.first << " Inserted.\n"; }
run
|
edit
|
history
|
help
0
BinTree
LP
HeatPump COP
Gauss v0.1
ASHA
Default_Template
C++ Car Racing game framework
<string> Indirect include of <errno.h> with gcc
BInTree Traversal
precision and fixed point notation