Getting started with c++

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:

/* Comment entry */
#include <iostream.h>
#include<conio.h>void main()

Preprocessor directives:

  1. #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.
  2. # indicates that these statements should be processed before the execution of main.


Header Files:

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:

  1. The files that are predefined and are included during the installation of the compiler.
  2. The files that are created by the user.

Header files are included in two ways.

  1. #include”headerfile.h”
  2. #include<headerfilename.h>

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 function:

  •  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.

Leave a Reply

Your email address will not be published. Required fields are marked *