- Star ⭐ the repository.
- Fork 🍴 it.
- Create Branch 🌿 with your feature
<feature>. - Push changes.
- Submit Pull Request 😄.
- Make PR(s) in either
snippetsdirectory or in one of the following : - If you are feeling confused on what to contribute, head over to Projects, select the directory you want to contribute to for e.g choose
<algorithm>& from the Algorithms To Implement column select any one method.You can either submit a small C++ code snippet demonstrating the same in thesnippetsdirectory or submit a overview of the choosen method in<name_of_directory>see for example all_of.md. - Always follow the style guide(see below).
- Do not update any
READMEortodo.txtfiles (unless you find a typo 😅) - Enjoy contributing 😋.
- If you have any doubts, open an issue.
For adding functions in different directories, use the following template (copy from raw format):
Description : < description >.
Example :
// YOUR CODE
std::vector<int> v{ 1, 2, 3, 4, 4, 3, 7, 8, 9, 10 };
// determine how many integers in a std::vector match a target value.
int target1 = 3;
int num_items1 = count(v.begin(), v.end(), target1);
std::cout << "number: " << target1 << " count: " << num_items1 << '\n';Follow this style guide to add sample programs:
-
Naming Style: For example if you are demonstrating
eraseinlistname your fileerase.mdand save it in thelistdirectory. -
For adding Code Snippets in the
snippetsdirectory. Add the following comment header in every program. The comment header should always be at the top of program.
/*
Author : this must be your name ;)
Date : Date format dd/mm/yyyy
Time : Time format hh:mm
Description : description should be small & one liner.
*/- Add Opening braces on the same line.
int main()
{
// ❌
}
int main(){
// ✅.
}-
Indentation : Use 1 Tab or 4 Spaces. Be consistent with whatever you choose Use only one indenting format for the whole program.
-
Add appropriate comments wherever necessary to explain the code.
Programs wth NO Comments at all will not be merged.
- Expression should be readable, Use 1 space between different TOKENS.
galaxy=stars+asteroids // ❌
galaxy = stars + asteroids // ✅.- Always add braces in a for/while loop, even if it's a one-liner.
for(int i=0;i<45;i++)
cout<<i<<" "; // ❌
for(int i=0;i<45;i++){
cout<<i<<" "; // ✅.
}-
Always use pre-increment(++i) while looping instead of post-increment(i++).
-
When submitting
markdownfiles of methods in different directories, name your file exactly as the function/method name. For examplepush_back.md,swap.mdetc. -
Always use prefix
std::for functions and types from the std namespace, either on themarkdownfiles and on the snippets files.
using namespace std;
vector<int> ...; // ❌
cout << ...; // ❌
std::vector<int> ...; // ✅
std::cout << ...; // ✅