SlideShare une entreprise Scribd logo
1  sur  15
BASICS OF C++
Chapter 2
1By:-Gourav Kottawar
contents
2
 2.1 A Brief History of C & C++
 2.2 C Vs C++
 2.3 A Simple C++ Program
 2.4 Application of C++
 2.5 Structure & Class
 2.6 Compiling & Linking
% - 3
By:-Gourav Kottawar
2.1 A Brief History of C & C++
3
 The C++ programming language
has a history going back to 1979,
when Bjarne Stroustrup was doing
work for his Ph.D. thesis
 The Simula 67 language
 "C with Classes“
 C++
By:-Gourav Kottawar
2.2 C Vs C++
4
C C++
Language
Type
Procedural Oriented Language
Multi paradigm language, includes STL,
generic programming, procedural
programming, functional programming,
metaprogramming Object Oriented
Programming
Platforms
Almost anything on the planet; requires
recompile
Any, but libraries used can make it limited
Developed
by
Dennis Ritchie & Bell Labs Bjarne Stroustrup
Influenced
awk, csh, C++, C#, Objective-C, BitC, D,
Concurrent C, Java, JavaScript, Limbo,
Perl, PHP
Ada 95, C#, Java, PHP, D, Aikido
Typing
Discipline
Static, Weak Static, Unsafe, Nominative
Paradigms
Imperative (procedural) systems
implementation language
Multi-paradigm, STL, generic programming,
procedural programming, functional
programming, metaprogrammingBy:-Gourav Kottawar
5
C C++
Influenced
by
B (BCPL,CPL), ALGOL 68, Assembly C, Simula, Ada 83, ALGOL 68, CLU, ML
Designed
by
Dennis Ritchie Bjarne Stroustrup
Programmi
ng-String
type
Cannot use string type but declare it
as an array of characters
Can use std::string or design a string by user
Major
Implement
ations
GCC, MSVC, Borland C, Watcom C
GNU Compiler Collection, Microsoft Visual C++,
Borland C++ Builder
Speed
C applications are faster to compile
and execute than C++ applications
+-5% when compare with C if you know how to
make a good use of C++.The performance of C++
and C are equal, since compilers are mature(now
is 2012), if your C++ codes are much slower than
C, don't flame C++ but blame yourself.
By:-Gourav Kottawar
6
OOP
(Object
Oriented
Programmi
ng)
Not built in; has the freedom to
setup structures to act like objects.
Lacking the ability to
encapsulate(annouced private) is a
big weakpoint
Yes-polymorphism and inheritance, Classes.
Appeared
in
1972 1985
Execution
Flow
Top to Bottom Bottom to Top
Garbage
Collection
Manual; allows better
management of memory.
Manual, you could manage the memory as C
did, or use smart pointer , destructor to provide
better and safer mechanism.According to your
implementation, smart pointer can be zero
runtime impact
Usual
filename
extensions
.c .cc, .cpp, .hh, .hpp
By:-Gourav Kottawar
Simple C++ program
7
#include <iostream.h>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
By:-Gourav Kottawar
Simple C++ program
8
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
By:-Gourav Kottawar
Simple C++ program
9
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
By:-Gourav Kottawar
namespace
 Namespace is a new concept introduced by the
ANSI C++ standards committee.
 This defines a scope for the identifiers that are
used in a program. For using the identifier defined
in the namespace scope we must include the
using directive, like
Using namespace std;
 Here, std is the namespace where ANSI C++
standard class libraries are defined.
 All ANSI C++ programs must include this
directive. This will bring all the identifiers defined in
std to the current global scope.
 Using and namespace are the new keyword of
C++.
10
By:-Gourav Kottawar
Simple C++ program
11
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
By:-Gourav Kottawar
Simple C++ program
12
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
By:-Gourav Kottawar
13
By:-Gourav Kottawar
14
By:-Gourav Kottawar
Applications of C++
 Since C++ allow us to create hierarchy related
objects, we can build special object-oriented
libraries which can be used later by many
programmers.
 While C++ is able to map the real-world problem
properly, the C part of C++ gives the language the
ability to get closed to the machine-level details.
 C++ programs are easily maintainable and
expandable. When a new feature needs to be
implemented, it is very easy to add to the existing
structure of an object.
• It is expected that C++ will replace C as a general-
purpose language in the near future.
15
By:-Gourav Kottawar

Contenu connexe

Tendances

Tendances (20)

Ppt of c++ vs c#
Ppt of c++ vs c#Ppt of c++ vs c#
Ppt of c++ vs c#
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
C language
C languageC language
C language
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++
 
C vs c++
C vs c++C vs c++
C vs c++
 
Chapter3
Chapter3Chapter3
Chapter3
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C language introduction
C language introduction C language introduction
C language introduction
 
C tutorial
C tutorialC tutorial
C tutorial
 
Learning c - An extensive guide to learn the C Language
Learning c - An extensive guide to learn the C LanguageLearning c - An extensive guide to learn the C Language
Learning c - An extensive guide to learn the C Language
 
C tokens
C tokensC tokens
C tokens
 
C notes
C notesC notes
C notes
 
Oops
OopsOops
Oops
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 

Similaire à basics of c++

Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
shokeenk14
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
Abbas Ajmal
 

Similaire à basics of c++ (20)

Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Unit i
Unit iUnit i
Unit i
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentals
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
 
Programming in c plus plus2
Programming in c plus plus2Programming in c plus plus2
Programming in c plus plus2
 
Oops index
Oops indexOops index
Oops index
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
Object oriented slides
Object oriented slidesObject oriented slides
Object oriented slides
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 

Plus de gourav kottawar

Plus de gourav kottawar (20)

operator overloading & type conversion in cpp
operator overloading & type conversion in cppoperator overloading & type conversion in cpp
operator overloading & type conversion in cpp
 
constructor & destructor in cpp
constructor & destructor in cppconstructor & destructor in cpp
constructor & destructor in cpp
 
classes & objects in cpp
classes & objects in cppclasses & objects in cpp
classes & objects in cpp
 
expression in cpp
expression in cppexpression in cpp
expression in cpp
 
basics of c++
basics of c++basics of c++
basics of c++
 
working file handling in cpp overview
working file handling in cpp overviewworking file handling in cpp overview
working file handling in cpp overview
 
pointers, virtual functions and polymorphisms in c++ || in cpp
pointers, virtual functions and polymorphisms in c++ || in cpppointers, virtual functions and polymorphisms in c++ || in cpp
pointers, virtual functions and polymorphisms in c++ || in cpp
 
exception handling in cpp
exception handling in cppexception handling in cpp
exception handling in cpp
 
cpp input & output system basics
cpp input & output system basicscpp input & output system basics
cpp input & output system basics
 
operator overloading & type conversion in cpp over view || c++
operator overloading & type conversion in cpp over view || c++operator overloading & type conversion in cpp over view || c++
operator overloading & type conversion in cpp over view || c++
 
constructor & destructor in cpp
constructor & destructor in cppconstructor & destructor in cpp
constructor & destructor in cpp
 
classes & objects in cpp overview
classes & objects in cpp overviewclasses & objects in cpp overview
classes & objects in cpp overview
 
expression in cpp
expression in cppexpression in cpp
expression in cpp
 
SQL || overview and detailed information about Sql
SQL || overview and detailed information about SqlSQL || overview and detailed information about Sql
SQL || overview and detailed information about Sql
 
SQL querys in detail || Sql query slides
SQL querys in detail || Sql query slidesSQL querys in detail || Sql query slides
SQL querys in detail || Sql query slides
 
Rrelational algebra in dbms overview
Rrelational algebra in dbms overviewRrelational algebra in dbms overview
Rrelational algebra in dbms overview
 
overview of database concept
overview of database conceptoverview of database concept
overview of database concept
 
Relational Model in dbms & sql database
Relational Model in dbms & sql databaseRelational Model in dbms & sql database
Relational Model in dbms & sql database
 
DBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) pptDBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) ppt
 
security and privacy in dbms and in sql database
security and privacy in dbms and in sql databasesecurity and privacy in dbms and in sql database
security and privacy in dbms and in sql database
 

Dernier

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

basics of c++

  • 1. BASICS OF C++ Chapter 2 1By:-Gourav Kottawar
  • 2. contents 2  2.1 A Brief History of C & C++  2.2 C Vs C++  2.3 A Simple C++ Program  2.4 Application of C++  2.5 Structure & Class  2.6 Compiling & Linking % - 3 By:-Gourav Kottawar
  • 3. 2.1 A Brief History of C & C++ 3  The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis  The Simula 67 language  "C with Classes“  C++ By:-Gourav Kottawar
  • 4. 2.2 C Vs C++ 4 C C++ Language Type Procedural Oriented Language Multi paradigm language, includes STL, generic programming, procedural programming, functional programming, metaprogramming Object Oriented Programming Platforms Almost anything on the planet; requires recompile Any, but libraries used can make it limited Developed by Dennis Ritchie & Bell Labs Bjarne Stroustrup Influenced awk, csh, C++, C#, Objective-C, BitC, D, Concurrent C, Java, JavaScript, Limbo, Perl, PHP Ada 95, C#, Java, PHP, D, Aikido Typing Discipline Static, Weak Static, Unsafe, Nominative Paradigms Imperative (procedural) systems implementation language Multi-paradigm, STL, generic programming, procedural programming, functional programming, metaprogrammingBy:-Gourav Kottawar
  • 5. 5 C C++ Influenced by B (BCPL,CPL), ALGOL 68, Assembly C, Simula, Ada 83, ALGOL 68, CLU, ML Designed by Dennis Ritchie Bjarne Stroustrup Programmi ng-String type Cannot use string type but declare it as an array of characters Can use std::string or design a string by user Major Implement ations GCC, MSVC, Borland C, Watcom C GNU Compiler Collection, Microsoft Visual C++, Borland C++ Builder Speed C applications are faster to compile and execute than C++ applications +-5% when compare with C if you know how to make a good use of C++.The performance of C++ and C are equal, since compilers are mature(now is 2012), if your C++ codes are much slower than C, don't flame C++ but blame yourself. By:-Gourav Kottawar
  • 6. 6 OOP (Object Oriented Programmi ng) Not built in; has the freedom to setup structures to act like objects. Lacking the ability to encapsulate(annouced private) is a big weakpoint Yes-polymorphism and inheritance, Classes. Appeared in 1972 1985 Execution Flow Top to Bottom Bottom to Top Garbage Collection Manual; allows better management of memory. Manual, you could manage the memory as C did, or use smart pointer , destructor to provide better and safer mechanism.According to your implementation, smart pointer can be zero runtime impact Usual filename extensions .c .cc, .cpp, .hh, .hpp By:-Gourav Kottawar
  • 7. Simple C++ program 7 #include <iostream.h> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } By:-Gourav Kottawar
  • 8. Simple C++ program 8 #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } By:-Gourav Kottawar
  • 9. Simple C++ program 9 #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } By:-Gourav Kottawar
  • 10. namespace  Namespace is a new concept introduced by the ANSI C++ standards committee.  This defines a scope for the identifiers that are used in a program. For using the identifier defined in the namespace scope we must include the using directive, like Using namespace std;  Here, std is the namespace where ANSI C++ standard class libraries are defined.  All ANSI C++ programs must include this directive. This will bring all the identifiers defined in std to the current global scope.  Using and namespace are the new keyword of C++. 10 By:-Gourav Kottawar
  • 11. Simple C++ program 11 #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } By:-Gourav Kottawar
  • 12. Simple C++ program 12 #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } By:-Gourav Kottawar
  • 15. Applications of C++  Since C++ allow us to create hierarchy related objects, we can build special object-oriented libraries which can be used later by many programmers.  While C++ is able to map the real-world problem properly, the C part of C++ gives the language the ability to get closed to the machine-level details.  C++ programs are easily maintainable and expandable. When a new feature needs to be implemented, it is very easy to add to the existing structure of an object. • It is expected that C++ will replace C as a general- purpose language in the near future. 15 By:-Gourav Kottawar