DAY 2



Basic structure of c++:
The format of writing program in c++ is called its structure. The basic structure of c++ program is very flexible. It increase the power of the language.
It consists of the following parts.
Preprocessor directive:
Its an instruction given to the compiler before the execution of actual program. Preprocessor directive is also known as compiler directive. The preprocessor directives are processed by a program known as preprocessor. Its part of c++ compiler. It modifies c++ source program before compilation.
The semi colon is not used at the end of preprocessor directive.
The preprocessor directive starts with a hash symbol #. These directives are written at the start of the program.
The following preprocessor directive is used to include header files in the program.

#include <iostream>
The above statement tells the computer to include header file that is "iostream" in source program before compiling it.

Header files:
Header files are the collection of standard library functions to perform different task.
There are many  header files for different purpose. Each header file contains different types of predefined functions. Many header files can be included in one program. The header file must be included in the program before calling any of its function in the program.
The header files are normally stored in include subdirectory. The name of header file is written in angle brackets.
SYNTAX.
#include <header_file_name>
The name of the header file can also be used in double quotes as follow.
#include "header_file_name".
EXAMPLE:
#include <iostream>

Main () Function:
It is the starting point of c++ program. When the program is run, the control enters the main() function and starts executing its statements.

main()
{
      body of main function

}.

C++ Statements:
The statements of the program is written in curly braces. The curly brace ( is called opening brace and ) is called closing brace. The braces are also known as delimeters. These statements are collectively known as body of the program. Each statement in c++ is terminated with semi colon.
EXAMPLE:



Basic language features:
Tokens:
Keywords,
Identifiers,
Literals,
Operators,
Punctuation/separator and
White spaces.

Values and Statements:
Statements and
Expression.

Operators:
Mathematical operator,
Logical operator and
Bitwise operator.



H

Comments

POPULAR POSTS

About C++

Language processors:

DAY 1