From c2e6329296323df022063f6e0411e815e0dca226 Mon Sep 17 00:00:00 2001 From: Nischay Hegde Date: Mon, 18 Feb 2019 03:42:48 +0530 Subject: [PATCH] Fixed grammar, among other things. (#27130) Since `#include ` is not a part of the C++ Standard, it was changed to more appropriate headers. Also fixed the grammatical errors here. Added a few helpful links. --- guide/english/cplusplus/c-stl-sets/index.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/guide/english/cplusplus/c-stl-sets/index.md b/guide/english/cplusplus/c-stl-sets/index.md index a65fb53018..eb88ffdc72 100644 --- a/guide/english/cplusplus/c-stl-sets/index.md +++ b/guide/english/cplusplus/c-stl-sets/index.md @@ -3,7 +3,7 @@ title: C++ STL Sets --- ## Introduction of sets in C++ STL library -Sets are a type of associative containers in which each element has to be unique.The value of the element cannot be modified once it is added to the set, though it is possible to remove and add the modified value of that element. They are implemented using red-black tree. +Sets are a type of associative container in which each element has to be unique. The value of the element cannot be modified once it is added to the set, though it is possible to remove and add the modified value of that element. They are implemented using [red-black tree](https://guide.freecodecamp.org/algorithms/red-black-trees/). ## Benefits of using sets 1. It stores only unique values. @@ -13,8 +13,11 @@ Sets are a type of associative containers in which each element has to be unique Example: ```c++ -#include -using namespace std; +#include +#include +using std::set; +using std::cout; +using std::endl; int main() { set s; @@ -25,13 +28,14 @@ int main() s.insert(2); //inserting same element 2 s.insert(6); for(auto i:s) - cout<::iterator it; -for(it=s.begin(); it!=s.end(); ++it) - cout<<*it; +for(it = s.begin(); it != s.end(); ++it) + cout << *it; ```