C++ language follows a predefined structure.C++ is a case sensitive language . The upper case and lower case characters are considered different in c++ programs.C++ is a strongly typed language, as every variable, expression and function belong to a particular type.
There are many sections in a c++ language syntax. Lets understand what each section means.
Structure of a c++ program:
- #include is used to include a file which contains some predefined functions which might be needed for the execution of the program. The contents of the header file are included in the program during the compilation process.
- # indicates that these statements should be processed before the execution of main.
Header file is the collection of functions and routines required frequqnetly by c++ programmes in various programs.These header files make the standard library of c++ langauge.Normally each header file has the extension of ‘.h’
‘iostream.h’ is a header file which has the functions related to input output operations.
Header files are of two types:
- The files that are predefined and are included during the installation of the compiler.
- The files that are created by the user.
Header files are included in two ways.
The use of double quotation indicates the header file is in the current directory where as ‘< >’ is used when the header files are in the standard library directory.
- Main is a function in c++. It is the entry point of any program. When ever the program execution begins the compiler searches for a main function and executes it. Even though you might have many functions in the program only the main function executes. In order to execute other functions , they need to be called inside the main function. Therefore, every program need one function named main. multiple main functions in the program are not valid as they cause ambiguity.