How can I define sets in C++ and insert values into them?
Asked
Active
Viewed 875 times
3
-
3Well, you'd have to start off by learning to Google... – Mahmoud Al-Qudsi Jan 02 '11 at 11:58
-
4@Computer Please read [this](http://meta.stackexchange.com/questions/8724/how-to-deal-with-google-questions). – moinudin Jan 02 '11 at 12:02
-
I wanted to use u're knowledge!!!! – Bahareh Jan 02 '11 at 12:37
1 Answers
16
Use the std::set
class in <set>
.
std::set<int> s; // define a set of ints
s.insert(1); // insert into a set

moinudin
- 134,091
- 45
- 190
- 216