Showing posts with label structure of c programing. Show all posts
Showing posts with label structure of c programing. Show all posts

Thursday, 14 September 2017

Structure and Syntax of program in c++

 Structure and Syntax of program

c++ Program | Syntax 


This Program we show prints Hello World on screen 

#include <iostream.h>
using namespace std;
int main ()
{
cout << "Hello World! Syntax ";
return 0;
}

1 . /* This program ... */
The symbols/* and*/ used for comment. This Comments are ignored by the compiler, and are used to provide useful information about program to humans who use it.

2. #include <iostream.h>

This is a preprocessor command which tells compiler to include iostream.h file.

3. using namespace std; 

All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std. So in order to access its functionality we declare Syntax with this expression that we will be using these entities. This line is very frequent in C++ programs Syntax that use the standard library.

4. main()

C++ programs consist of one or more functions. There must be one and only one function called main. The brackets following the word main indicate that it is a function and not a variable .

5. { }
Syntax braces surround the body of the function, which may havee one or more instructions/statements.

6. Cout<<

it is a library function that is used to print data on the user screen.

7. ''Hello World'' is a string that will be displayed on user screen 

8. ; a semicolon ends a statement Syntax .

9. return 0; return the value zero to the Operating system.