NOTE: You may download codes and extra source material for this book from https://bookofengineering.com/easyseries/
The “//” sign means you are adding a comment. This is called line comment. The things you write after these “//” will not be taken as a command (means these things will not be compiled). It is always a good approach to write down the properties of the code at the beginning like author, for which aim this code is written etc.
You can also line comment after a code;
- //my first c++ program
- #include <iostream>
- using namespace std;
- int main(){
- cout<<“hello world!”; // this is my first print on screen
- return 0;
- system(“pause”);
- }
Here on the line #5 you see that “//” is used after a command. So, we can also explain what some part of the code means and we will use these as much as possible so that the other programmers that try to modify the code we wrote will be easily getting the idea. There is always a saying between the programmers like “it is easy to code from scratch compared to modify a code written by someone else”. And that is pretty true especially if the programmer is untidy.
NOTE: You may buy this course in paperbook book format from https://www.amazon.com/dp/B0892HQTGS