Wednesday, 23 August 2017

Comments in C++ Programming



Comments In C++ Programming Language

Simple steps:-  www.scpinfotech.com 
Comments are parts of the source code disregarded by the compiler.
C++ supports two ways to insert comments:
// Single Line comment
/* block comment */ 
The first of them, known as line comment, discards everything from where the pair of slash signs (//) is found up to the end of that same line. The second one, known as block comment, discards everything between the /* characters and the first appearance of the */ characters, with the possibility of including more than one line.
We are going to add comments to our second program:

Example:- 

/* my second program in C++
   with more comments */
 
#include <iostream>
using namespace std;
 
int main ()
{
  cout << "Hello SCP Infotech! ";     // prints Hello World!
  cout << "I'm a C++ program"; // prints I'm a C++ program
  return 0;
}
Hello SCP Infotech! I'm a C++ program


No comments:

Post a Comment