SlideShare a Scribd company logo
1 of 20
Download to read offline
Lecture 17
 C++ is an object-oriented programming language
which allows code to be reused, lowering development
costs.
 C++ was developed by Bjarne Stroustrup, as an
extension to the C language.
 C++ gives programmers a high level of control over
system resources and memory.
 Object-Oriented Programming:
 It allows the programmer to design applications like a communication
object rather than on a structured sequence of code.
 Portability:
 We can compile the same C++ code in almost any type of computer &
operating system without making any changes.
 Modular Programming:
 An application’s body in C++ can be made up of several source code
files that are compiled separately and then linked together saving time.
 C Compatibility:
 Any code written in C can easily be included in a C++ program without
making any changes.
Speed
 The resulting code compilation is very efficient due to its duality
as high-level and low-level language.
Flexibility:
 It is highly flexible language and versatility.
Wide range of library functions:
 It has huge library functions; it reduces the code development
time and also reduces cost of software development.
System Software Development:
 It can be used for developing System Software Viz., Operating
system, Compilers, Editors and Database.
 The C++ program is written using a specific template structure. The
structure of the program written in C++ language is as follows:
 This section comes first and is used to document the
logic of the program that the programmer going to
code.
 It can be also used to write for purpose of the program.
 Whatever written in the documentation section is the
comment and is not compiled by the compiler.
 Documentation Section is optional since the program
can execute without them. Below is the snippet of the
same:
The linking section contains two parts:
 Header Files
Generally, a program includes various programming elements like built-in
functions, classes, keywords, constants, operators, etc. that are already
defined in the standard C++ library.
In order to use such pre-defined elements in a program, an appropriate
header must be included in the program.
 Namespaces
A namespace permits grouping of various entities like classes, objects, functions, and
various C++ tokens, etc. under a single name.
 Standard headers are specified in a program through
the preprocessor directive #include.
 In Figure, the iostream header is used. When the compiler processes the
instruction #include<iostream>, it includes the contents of the stream in the
program. This enables the programmer to use standard input, output, and
error facilities that are provided only through the standard streams defined
in <iostream>
 The standard streams defined in <iostream> are listed here.
 Any user can create separate namespaces of its own and can use them in
any other program.
 In the below snippets, namespace std contains declarations for cout,
cin, endl, etc. statements.
 using namespace std;
Namespaces can be accessed in multiple ways:
◦ using namespace std;
◦ using std :: cout;
 It is used to declare some constants and assign them some value.
 In this section, anyone can define your own datatype using primitive data
types.
 In #define is a compiler directive which tells the compiler whenever the
message is found to replace it with “Factorialn”.
 typedef int INTEGER; this statement tells the compiler that whenever
you will encounter INTEGER replace it by int and as you have declared
INTEGER as datatype you cannot use it as an identifier.
 Here, the variables and the class definitions which are
going to be used in the program are declared to make
them global.
 The scope of the variable declared in this section lasts
until the entire program terminates.
 These variables are accessible within the user-defined
functions also.
 It contains all the functions which our main functions
need.
 Usually, this section contains the User-defined
functions.
 This part of the program can be written after the main
function but for this, write the function prototype in this
section for the function which for you are going to
write code after the main function.
 The main function tells the compiler where to start the
execution of the program. The execution of the
program starts with the main function.
 All the statements that are to be executed are written in
the main function.
 The compiler executes all the instructions which are
written in the curly braces {} which encloses the body
of the main function.
 Once all instructions from the main function are
executed, control comes out of the main function and
the program terminates and no further execution occur.
Editor:
The editor is where programmers write and edit source code files. It provides features such as
syntax highlighting, code completion, and indentation.
Preprocessor:
The preprocessor phase handles preprocessor directives, such as #include and #define. It
prepares the source code for compilation by replacing macros and including header files.
Compiler:
The compiler translates the preprocessed source code into machine-readable instructions, known
as object code or machine code.
Linker:
The linker combines object code files generated by the compiler and resolves external references
between them. It produces a single executable file.
Loader:
The loader loads the executable file into memory for execution. It also resolves any dynamic link
library (DLL) dependencies required by the program.
Execution:
Finally, the operating system executes the program by loading it into memory and following the
instructions encoded in the executable file. The program's output is displayed to the user.
 The program execution process consists of the following steps
Computers execute binary instructions. These binary instructions are known as
machine instructions or machine code.
The program creation process consists of the following steps:
 Step 1 – Write the program in a computer language humans
can read and understand (like C++),
 Step 2 – Save the programs in text files. Programs can be a
few lines long and reside in one file or can consist of many
millions of lines of code and span thousands of files,
 Step 3 – Run the source code files through a program called
a compiler to generate object code for the target computer,
 Step 4 – Run the object files through a program called a
linker to produce an executable image.
#include <iostream>
Using namespace std;
int main( )
{
cout << "Hello, World!";
return 0;
 }

More Related Content

Similar to Introduction To C++ programming and its basic concepts

Overview of c++
Overview of c++Overview of c++
Overview of c++geeeeeet
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxSanketShah544615
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1Hitesh Mohapatra
 
Btech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageRai University
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and developmentAli Raza
 
introduction to c language
 introduction to c language introduction to c language
introduction to c languageRai University
 
Bsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageBsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageRai University
 
Diploma ii cfpc u-1 introduction to c language
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c languageRai University
 
Mca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageRai University
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer muniryaseen
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution pptKeerty Smile
 

Similar to Introduction To C++ programming and its basic concepts (20)

C lecture notes new
C lecture notes newC lecture notes new
C lecture notes new
 
C programming
C programmingC programming
C programming
 
Unit-2.pptx
Unit-2.pptxUnit-2.pptx
Unit-2.pptx
 
Overview of c++
Overview of c++Overview of c++
Overview of c++
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1
 
INTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptxINTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptx
 
Btech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c language
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
 
Embedded C.pptx
Embedded C.pptxEmbedded C.pptx
Embedded C.pptx
 
Bsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageBsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c language
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Diploma ii cfpc u-1 introduction to c language
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c language
 
Mca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c language
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
COMPILER DESIGN.docx
COMPILER DESIGN.docxCOMPILER DESIGN.docx
COMPILER DESIGN.docx
 

More from ssuserf86fba

Lecture of using iict concept in c++ basic
Lecture of using iict concept in c++ basicLecture of using iict concept in c++ basic
Lecture of using iict concept in c++ basicssuserf86fba
 
Input and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesInput and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesssuserf86fba
 
detail of flowchart and algorithm that are used in programmingpdf
detail of flowchart and algorithm that are used in programmingpdfdetail of flowchart and algorithm that are used in programmingpdf
detail of flowchart and algorithm that are used in programmingpdfssuserf86fba
 
problem solving skills and its related all information
problem solving skills and its related all informationproblem solving skills and its related all information
problem solving skills and its related all informationssuserf86fba
 
system and application software are used in computer.
system and application software are used in computer.system and application software are used in computer.
system and application software are used in computer.ssuserf86fba
 
its about computer storage and its managements how to manage the memory, in a...
its about computer storage and its managements how to manage the memory, in a...its about computer storage and its managements how to manage the memory, in a...
its about computer storage and its managements how to manage the memory, in a...ssuserf86fba
 
computerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdfcomputerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdfssuserf86fba
 
number system in introduction to computer language
number system in introduction to computer languagenumber system in introduction to computer language
number system in introduction to computer languagessuserf86fba
 
introduction to computer and technology-Lecture-1.pdf
introduction to computer and technology-Lecture-1.pdfintroduction to computer and technology-Lecture-1.pdf
introduction to computer and technology-Lecture-1.pdfssuserf86fba
 
cache memory and cloud computing technology
cache memory and cloud computing technologycache memory and cloud computing technology
cache memory and cloud computing technologyssuserf86fba
 
its about information process cycle and its components
its about information process cycle and its componentsits about information process cycle and its components
its about information process cycle and its componentsssuserf86fba
 
cental processing unit and all its components
cental processing unit and all its componentscental processing unit and all its components
cental processing unit and all its componentsssuserf86fba
 
Ipc (how we transfer the information end to end
Ipc (how we transfer the information end to endIpc (how we transfer the information end to end
Ipc (how we transfer the information end to endssuserf86fba
 
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdfLecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdfssuserf86fba
 

More from ssuserf86fba (14)

Lecture of using iict concept in c++ basic
Lecture of using iict concept in c++ basicLecture of using iict concept in c++ basic
Lecture of using iict concept in c++ basic
 
Input and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesInput and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequences
 
detail of flowchart and algorithm that are used in programmingpdf
detail of flowchart and algorithm that are used in programmingpdfdetail of flowchart and algorithm that are used in programmingpdf
detail of flowchart and algorithm that are used in programmingpdf
 
problem solving skills and its related all information
problem solving skills and its related all informationproblem solving skills and its related all information
problem solving skills and its related all information
 
system and application software are used in computer.
system and application software are used in computer.system and application software are used in computer.
system and application software are used in computer.
 
its about computer storage and its managements how to manage the memory, in a...
its about computer storage and its managements how to manage the memory, in a...its about computer storage and its managements how to manage the memory, in a...
its about computer storage and its managements how to manage the memory, in a...
 
computerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdfcomputerarchitecturecachememory-170927134432.pdf
computerarchitecturecachememory-170927134432.pdf
 
number system in introduction to computer language
number system in introduction to computer languagenumber system in introduction to computer language
number system in introduction to computer language
 
introduction to computer and technology-Lecture-1.pdf
introduction to computer and technology-Lecture-1.pdfintroduction to computer and technology-Lecture-1.pdf
introduction to computer and technology-Lecture-1.pdf
 
cache memory and cloud computing technology
cache memory and cloud computing technologycache memory and cloud computing technology
cache memory and cloud computing technology
 
its about information process cycle and its components
its about information process cycle and its componentsits about information process cycle and its components
its about information process cycle and its components
 
cental processing unit and all its components
cental processing unit and all its componentscental processing unit and all its components
cental processing unit and all its components
 
Ipc (how we transfer the information end to end
Ipc (how we transfer the information end to endIpc (how we transfer the information end to end
Ipc (how we transfer the information end to end
 
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdfLecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
 

Recently uploaded

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

Introduction To C++ programming and its basic concepts

  • 2.  C++ is an object-oriented programming language which allows code to be reused, lowering development costs.  C++ was developed by Bjarne Stroustrup, as an extension to the C language.  C++ gives programmers a high level of control over system resources and memory.
  • 3.  Object-Oriented Programming:  It allows the programmer to design applications like a communication object rather than on a structured sequence of code.  Portability:  We can compile the same C++ code in almost any type of computer & operating system without making any changes.  Modular Programming:  An application’s body in C++ can be made up of several source code files that are compiled separately and then linked together saving time.  C Compatibility:  Any code written in C can easily be included in a C++ program without making any changes.
  • 4. Speed  The resulting code compilation is very efficient due to its duality as high-level and low-level language. Flexibility:  It is highly flexible language and versatility. Wide range of library functions:  It has huge library functions; it reduces the code development time and also reduces cost of software development. System Software Development:  It can be used for developing System Software Viz., Operating system, Compilers, Editors and Database.
  • 5.  The C++ program is written using a specific template structure. The structure of the program written in C++ language is as follows:
  • 6.  This section comes first and is used to document the logic of the program that the programmer going to code.  It can be also used to write for purpose of the program.  Whatever written in the documentation section is the comment and is not compiled by the compiler.  Documentation Section is optional since the program can execute without them. Below is the snippet of the same:
  • 7.
  • 8. The linking section contains two parts:  Header Files Generally, a program includes various programming elements like built-in functions, classes, keywords, constants, operators, etc. that are already defined in the standard C++ library. In order to use such pre-defined elements in a program, an appropriate header must be included in the program.  Namespaces A namespace permits grouping of various entities like classes, objects, functions, and various C++ tokens, etc. under a single name.
  • 9.  Standard headers are specified in a program through the preprocessor directive #include.  In Figure, the iostream header is used. When the compiler processes the instruction #include<iostream>, it includes the contents of the stream in the program. This enables the programmer to use standard input, output, and error facilities that are provided only through the standard streams defined in <iostream>  The standard streams defined in <iostream> are listed here.
  • 10.  Any user can create separate namespaces of its own and can use them in any other program.  In the below snippets, namespace std contains declarations for cout, cin, endl, etc. statements.  using namespace std; Namespaces can be accessed in multiple ways: ◦ using namespace std; ◦ using std :: cout;
  • 11.  It is used to declare some constants and assign them some value.  In this section, anyone can define your own datatype using primitive data types.  In #define is a compiler directive which tells the compiler whenever the message is found to replace it with “Factorialn”.  typedef int INTEGER; this statement tells the compiler that whenever you will encounter INTEGER replace it by int and as you have declared INTEGER as datatype you cannot use it as an identifier.
  • 12.  Here, the variables and the class definitions which are going to be used in the program are declared to make them global.  The scope of the variable declared in this section lasts until the entire program terminates.  These variables are accessible within the user-defined functions also.
  • 13.  It contains all the functions which our main functions need.  Usually, this section contains the User-defined functions.  This part of the program can be written after the main function but for this, write the function prototype in this section for the function which for you are going to write code after the main function.
  • 14.
  • 15.  The main function tells the compiler where to start the execution of the program. The execution of the program starts with the main function.  All the statements that are to be executed are written in the main function.  The compiler executes all the instructions which are written in the curly braces {} which encloses the body of the main function.  Once all instructions from the main function are executed, control comes out of the main function and the program terminates and no further execution occur.
  • 16.
  • 17. Editor: The editor is where programmers write and edit source code files. It provides features such as syntax highlighting, code completion, and indentation. Preprocessor: The preprocessor phase handles preprocessor directives, such as #include and #define. It prepares the source code for compilation by replacing macros and including header files. Compiler: The compiler translates the preprocessed source code into machine-readable instructions, known as object code or machine code. Linker: The linker combines object code files generated by the compiler and resolves external references between them. It produces a single executable file. Loader: The loader loads the executable file into memory for execution. It also resolves any dynamic link library (DLL) dependencies required by the program. Execution: Finally, the operating system executes the program by loading it into memory and following the instructions encoded in the executable file. The program's output is displayed to the user.
  • 18.  The program execution process consists of the following steps
  • 19. Computers execute binary instructions. These binary instructions are known as machine instructions or machine code. The program creation process consists of the following steps:  Step 1 – Write the program in a computer language humans can read and understand (like C++),  Step 2 – Save the programs in text files. Programs can be a few lines long and reside in one file or can consist of many millions of lines of code and span thousands of files,  Step 3 – Run the source code files through a program called a compiler to generate object code for the target computer,  Step 4 – Run the object files through a program called a linker to produce an executable image.
  • 20. #include <iostream> Using namespace std; int main( ) { cout << "Hello, World!"; return 0;  }