Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 4.88 KB

CONTRIBUTING.md

File metadata and controls

116 lines (90 loc) · 4.88 KB

Welcome 😄

To start contributing, follow these steps 👇:

  1. Star ⭐ the repository (not necessary but it helps maintainers).
  2. Fork 🍴 it.
  3. Create Branch 🌿 with your feature <feature>.
  4. Push changes.
  5. Submit Pull Request 😄.
  6. Make PR(s) in either snippets directory or in one of the following :
  7. 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 the snippets directory or submit a overview of the choosen method in <name_of_directory> see for example all_of.md.
  8. Always follow the style guide.
  9. Do not update any README.md or todo.txt files (unless you find a typo 😅)
  10. Enjoy contributing!.
  11. If you have any doubts, open an issue.

For adding functions in different directories, use the following template (copy from raw format):


name

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';

See Sample code
Run Code


Style Guide

Follow this style guide to add sample programs:

  1. Naming Style: For example if you are demonstrating erase in list name your file erase.md and save it in the list directory.

  2. For adding Code Snippets in the snippets directory. 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.
*/
  1. Add Opening braces on the same line.
    int main()
    {
                            //
    }

    int main() {
                            // ✅.
    }
  1. Indentation : Use 1 Tab or 4 Spaces. Be consistent with whatever you choose Use only one indenting format for the whole program.

  2. Add appropriate comments wherever necessary to explain the code.

Programs wth NO Comments at all will not be merged.

  1. Expression should be readable, Use 1 space between different tokens.
    galaxy=stars+asteroids          //
    galaxy = stars + asteroids      // ✅.
  1. Always add braces in a for/while loop, even if it's a one-liner.
    for (int i = 0; i < 45 ; i++)
        std::cout << i << " ";               //
    
    for (int i = 0;i < 45; ++i){
        std::cout << i << " ";               // ✅.
    }
  1. Always use pre-increment(++i) in loops instead of post-increment(i++).

  2. When submitting markdown files of methods in different directories, name your file exactly as the function/method name. For example push_back.md, swap.md etc.

  3. Always use prefix std:: for functions and types from the std namespace, either on the markdown files or on the snippet code files.

    using namespace std;   //
    vector<int> ...;       //
    cout << ...;           //

    std::vector<int> ...;  //
    std::cout << ...;      //
  1. It is strongly recommended not to use #include <bits/stdc++.h> as header file because many compilers do not support this header file.