Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link
Posts

2.1 Structure of program

1 min read
/* This Program prints Hello World on screen */
#include <iostream.h>
using namespace std;
int main ()
{
cout << "Hello World!";
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 with this expression that we will be using these entities. This line is very frequent in C++ programs 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. { }
braces surround the body of the function, which may have 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.

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

                      3.1 Variables          NEXT >>

You may like these posts

  • In Array we can store data of one type only, but structure is a variable that gives facility of storing data of different data type in one variable. Structures are variab…
  • Array is a fixed size collection of similar data type items. Arrays are used to store and access group of data of same data type. Arrays can of any data type. Arrays must…
  •   An operator is a symbol. Compiler identifies Operator and performs specific mathematical or logical operation. C provides following operators : # Arithmetic Operators # L…
  • C++ allows us to create own own data types. enumerated type is the simplest method for doing so. An enumerated type is a data type where every possible value is defined as a s…
  • References are another variable type of C++ that act as an alias or short name to another variable. A reference variable acts just like the original variable it is referencin…
  • Pointer is a variable that stores the address of another variable. They can make some things much easier, help improve your program's efficiency, and even allow you to handle u…

Post a Comment