Saturday, October 23, 2010

Writing a Simple C++ Program


Printing a string to console…

Code


Figure: Printing a String on the Console's Output Window



Explanation

In the above example "# include " is the preprocessor directive which tells the compiler to add a file from library.

"iostream.h" is a header file which controls basic input/output commands.

"using" is a directive while namespace is the part of program in which names are recognized, in this case "std".

"void main()" is the main function which is always executed at the start.

"{}" are function body delimiters.


 

No comments:

Post a Comment

Please comment, if you like the post, you find any mistake or if you have any query.