Any line that starts with a // is a comment. Unlike the C type of comments that start /* and end */, the double forward slashes end with the end of line. To comment large swathes of code out, you would still use /* comments here */ as adding // to the start of each line is tedious.
Best Practices for CommentingIt is a very good idea to give variables meaningful names, not just A and B that I've used here. When you return to code you wrote a few months or years later, those variable names will get you back up to speed pronto.
If you saw this code
You might guess it was converting fahrenheit to celsius.
float f= 128; float c= (f-32)*5/9; // Do conversion cout << f << c << endl;
But the second example is self explanatory.
float fahrenheit= 128; float celsius= (fahrenheit-32)*5/9; cout << fahrenheit << celsius << endl;
Professional developers have to follow "house rules" for naming variables and even function names. Eg if your function does something, call it DoWhatever() (where whatever is what ever it does). If it fetches a value from a database then ReadValue or FetchValue might be appropriate. Additionally, comments should be used to document the values passed in and any information about how they should be used. Always imagine you are writing the code for someone else to read and maintain.
That completes this lesson.