Effectively commenting your code
Very often, a programmer is so engrossed in solving a problem that they forget to comment their code. Although this may not be a problem when they are working on it, if there are other team members involved who have to utilize that same section of code, it may become very difficult to fathom. Therefore, it is essential to comment code from an early stage of development.
Getting ready
To work through this recipe, you will need a machine running Windows and Visual Studio. No other prerequisites are required.
How to do it…
In this recipe, we will see how easy it is to comment code. Let's add a source file called Source.cpp
. Add the following code to the file:
//Header files #include <iostream> class Game { //Member variables (Already known) public: private: protected: }; //Adding 2 numbers int Add(int a=4,int b=5) { return a + b; } void Logic(int a,int b) { if (a > 10 ? std::cout << a : std::cout << b); } int main...