Return to Topic Menu | Computer Science Main Page | MathBits.com  | Terms of Use

Demo 2:  Demo of comments

//************************************
//    Name:  William Ryker
//    Assignment:  Unit 1 #2
//    The "Hi" program
//    Date:  Stardate 2504
//************************************ 

#include <iostream.h>

int main(void)
{
      cout<< “Hi!”;    // message to user

     return 0;  //terminate main and return integer 0
}
/* this older style of commenting allows a comment to wrap around the screen until the terminating symbol is typed. */

     

 

The CODE: Information about the code:
//************************************
//    Name:  William Ryker
//    Assignment:  Unit 1 #2
//    The "Hi" program
//    Date:  Stardate 2504
//************************************ 
All programs should begin with a comment identifying the programmer and the purpose of the program. 
int main(void)
{
      cout<< “Hi!”;    // message to user

     return 0;  //terminate main and return integer 0
}

Comments can also be placed within the body of a program to act as documentation.  These comments should be brief and to the point.
This body prints
Hi! on the screen.
/* this older style of commenting allows a comment to wrap around the screen until the terminating symbol is typed. */ This "older" form of commenting which was developed for the C language, is used by C++ programmers to display lengthy comments that wrap around the screen.

 

Return to Topic Menu | Computer Science Main Page | MathBits.com  | Terms of Use