SlideShare a Scribd company logo
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:
Introduction To C++ programming and its basic concepts
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.
Introduction To C++ programming and its basic concepts
 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.
Introduction To C++ programming and its basic concepts
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

PPT
Fp201 unit2 1
PPTX
Lec01-02 (Topic 1 C++ Fundamentals).pptx
PPTX
C++ AND CATEGORIES OF SOFTWARE
PPTX
Csc240 -lecture_3
PDF
Cp week _2.
PDF
Prog1-L1.pdf
PPT
Overview of c++
PPTX
Whole c++ lectures ITM1 Th
Fp201 unit2 1
Lec01-02 (Topic 1 C++ Fundamentals).pptx
C++ AND CATEGORIES OF SOFTWARE
Csc240 -lecture_3
Cp week _2.
Prog1-L1.pdf
Overview of c++
Whole c++ lectures ITM1 Th

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

PPTX
C++ l 1
PPTX
Introduction to C Language (By: Shujaat Abbas)
PPTX
Introduction Of C++
PPTX
Paksitan Zindabad in ITDevelopment of IT
PPT
Lecture01
PPTX
C Programming UNIT 1.pptx
PPTX
computer programming omputer programming
PPTX
Object oriented programming 11 preprocessor directives and program structure
PPTX
Programming Fundamentals IDE's Lec3.pptx
PPTX
Introduction to cpp language and all the required information relating to it
PPTX
basic program
PPTX
C++ Constructs.pptx
PPT
Basic structure of C++ program
PDF
C++ advanced PPT.pdf
PDF
C_and_C++_notes.pdf
PPT
2621008 - C++ 1
PPTX
Revision Lecture
PPT
chapter-2.ppt
PPT
cppProgramStructure.ppt
C++ l 1
Introduction to C Language (By: Shujaat Abbas)
Introduction Of C++
Paksitan Zindabad in ITDevelopment of IT
Lecture01
C Programming UNIT 1.pptx
computer programming omputer programming
Object oriented programming 11 preprocessor directives and program structure
Programming Fundamentals IDE's Lec3.pptx
Introduction to cpp language and all the required information relating to it
basic program
C++ Constructs.pptx
Basic structure of C++ program
C++ advanced PPT.pdf
C_and_C++_notes.pdf
2621008 - C++ 1
Revision Lecture
chapter-2.ppt
cppProgramStructure.ppt
Ad

More from ssuserf86fba (16)

PDF
Lecture 1(i). ifs about information process cyle using ict concept
PDF
Lecture 1.pdf its about introduction of information and .
PPTX
Lecture of using iict concept in c++ basic
PDF
Input and output basic of c++ programming and escape sequences
PDF
detail of flowchart and algorithm that are used in programmingpdf
PDF
problem solving skills and its related all information
PDF
system and application software are used in computer.
PDF
its about computer storage and its managements how to manage the memory, in a...
PDF
computerarchitecturecachememory-170927134432.pdf
PDF
number system in introduction to computer language
PDF
introduction to computer and technology-Lecture-1.pdf
PPTX
cache memory and cloud computing technology
PDF
its about information process cycle and its components
PDF
cental processing unit and all its components
PPTX
Ipc (how we transfer the information end to end
PDF
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture 1(i). ifs about information process cyle using ict concept
Lecture 1.pdf its about introduction of information and .
Lecture of using iict concept in c++ basic
Input and output basic of c++ programming and escape sequences
detail of flowchart and algorithm that are used in programmingpdf
problem solving skills and its related all information
system and application software are used in computer.
its about computer storage and its managements how to manage the memory, in a...
computerarchitecturecachememory-170927134432.pdf
number system in introduction to computer language
introduction to computer and technology-Lecture-1.pdf
cache memory and cloud computing technology
its about information process cycle and its components
cental processing unit and all its components
Ipc (how we transfer the information end to end
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Ad

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Onica Farming 24rsclub profitable farm business
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Insiders guide to clinical Medicine.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
Anesthesia in Laparoscopic Surgery in India
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
Cell Structure & Organelles in detailed.
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Onica Farming 24rsclub profitable farm business
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
Revamp in MTO Odoo 18 Inventory - Odoo Slides
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
Open Quiz Monsoon Mind Game Prelims.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:
  • 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.
  • 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.
  • 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;  }