Added reference links section (#29593)
* Added reference links section * fix: changed c++ to cpp * fix: changed one extra c++ to cpp
This commit is contained in:
committed by
Randell Dawson
parent
39352ce64d
commit
098f9c478e
@ -12,12 +12,13 @@ Sets are a type of associative container in which each element has to be unique.
|
|||||||
4. There are many inbuilt functions in class defining sets that ease the programming.
|
4. There are many inbuilt functions in class defining sets that ease the programming.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```c++
|
```cpp
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
set <int> s;
|
set <int> s;
|
||||||
@ -38,20 +39,22 @@ return 0;
|
|||||||
[Try this code out yourself!](https://wandbox.org/permlink/XIFK4d9suQdGniFm)
|
[Try this code out yourself!](https://wandbox.org/permlink/XIFK4d9suQdGniFm)
|
||||||
|
|
||||||
Creating a set object
|
Creating a set object
|
||||||
```c++
|
```cpp
|
||||||
set <int> s;
|
set <int> s;
|
||||||
```
|
```
|
||||||
|
|
||||||
Insertion
|
Insertion
|
||||||
```c++
|
```cpp
|
||||||
s.insert(value_to_be_inserted);
|
s.insert(value_to_be_inserted);
|
||||||
```
|
```
|
||||||
|
|
||||||
Accessing set elements
|
Accessing set elements
|
||||||
```c++
|
```cpp
|
||||||
set <int>::iterator it;
|
set <int>::iterator it;
|
||||||
for(it = s.begin(); it != s.end(); ++it)
|
for(it = s.begin(); it != s.end(); ++it)
|
||||||
cout << *it;
|
cout << *it;
|
||||||
```
|
```
|
||||||
|
## Reference Links
|
||||||
|
|
||||||
|
[Geeks for Geeks link to C++ stl](https://www.geeksforgeeks.org/set-in-cpp-stl/ )
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user