SlideShare a Scribd company logo
ICIT COMPUTER
INSTITUE
This lecture
•   Five reasons to learn C/C++
•   History of C and C++
•   Aims of c and c++
•   Procedural languages & oo languages
•   Similarities between c & c++
•   Differences between c & c++
•   Compilation, Linkage and Running
•   Packages
•   Functions
Five reasons to learn C & C++?
1. (Still) utilised in industry
     Why so popular? (after so long)
2. Choose the appropriate tool for the task
     Understand the Java vs C/C++ differences
3. More programming practice
     Much is common across languages
4. Much is VERY similar to Java
     Easier to learn: much will be familiar to you
5. Useful for other modules
     And projects
The history of C/C++
In Bell Labs, ‘B’ language created, based on BCPL
1971-1973 : Dennis Ritchie extended ‘B’ to create ‘C’
   Main features of C developed over this time
1973-1980 : New features were added
   C needed to be standardised!
1979 : Bjarne Stroustrup (Bell labs) extended C to make ‘C with classes’
1982 : ‘K&R’ (Kernighan and Ritchie) unofficial C ‘standard’
1983 : ‘C with classes’ renamed C++, features still being added
1989 : ANSI standard C (started in 1983!) (=> ISO standard in 1990)
   Differs in some ways from K&R ‘C’ and is often named ‘C89’
   Together with Amendment 1, forms ‘C’ element of ‘C++’
1990s : C++ took centre stage (Standardisation progressing)
1994 : Standard Template Library makes it into the ISO standard C++
   (Some template implementation arguments ongoing as late as 2003)
1995 : Java released by Sun
1998 : ISO standard C++ ratified (C++98)
1999 : New version of C standard (C99) (Differs from C++)

  We will concentrate on C89 and C++
The aims of C and C++
• C came first : with specific design aims
  • Ability to write low-level code (e.g. O/S)
  • Speed and efficiency
  • Ease for programmers
    • Rather than non-programmers


• C++ grew from C : kept some similar aims
Is C++ O.O. or Procedural
• C is procedural (no classes, hard to do OO)
• C++ will let you do either
  • You CAN write procedural C++
  • Or you can write object oriented C++
  • Or mix both together (often a bad idea)
• C++ also adds a lot of non-OO features
  • e.g. templates, new/delete, operator overloading, …
  • Useful for procedural programming as well
Object oriented vs Procedural
• My view:
  • Procedural or object oriented are ways of thinking
• How do you want to think of your program?
  • A lot of communicating objects
  • Or ‘do this then this then this…’
• Whichever you use: (within a thread)
  • Functions are still called one at a time
  • And operations are executed one at a time
OO – a good or bad thing?
• Object oriented techniques can hide some of the
  complexity (a good thing?)
  • Make it easier to understand a program (?)
  • Make it easier to structure a large program (?)
  • Some facilities hide what is actually happening, to
    simplify things (bad?)
• We are going to look at C/C++, not object oriented
  design/programming
• Many courses start with object oriented C++
Similarities
• same built-in data types
• same compiler preprocessor
   • handles #include & #define
• same built-in operators on primitive types
  (+-/*……)
Similarities (cont.)
• Same built-in control structures
   • if, for, while, switch ….
• must have a function names “main” to
  determine where the program starts
• functions are defined the same way
• programs can be split up into separate files
Differences
• in C all code exists in function and the
  paradigm is that you manipulate data with
  functions
• in C++ classes are used to model the
  behavior of data objects, behavior is
  represented by functions and those
  functions are used to modify the object’s
  data
Differences (cont.)
• in C a struct is used to make an aggregate type
  and cannot have associated functions
• in C++ struct there may be associated (part of
  the struct) functions to process the data
• in C I/O is accomplished via library functions,
  in C++ it is done by using object methods.
Differences (cont.)
• C++ has function overloading (two functions may
  have the same name), in C function names must be
  unique.
• C++ has operator overloading (operators can be
  redefined to do other things)
• C++ uses “nbew” and “delete” for dynamic memory
  management, C uses “malloc” and “free”
Machine Language
 • A system of instructions and data directly
   executed by a computer’s central processing unit
 • Machine language is represented by bits (binary
   digits) i.e. 0s and 1s.
 • Example: 00111010
Assembly Language
 • More readable version of machine language
 • Uses mnemonic codes to refer to machine code
   instructions
 • Example:
  INC A (Increment Register A), DEC B (Decrement
  Register B)
High Level Language
 • Easier to use and more portable across platforms

 • Represented using English like statements

 • Examples: Basic, Fortran, Cobol, C.
Compilation and Execution
    of C++ programs
STEP 1:- Compilation
      Example.cpp    This code is written in c++
     (source code)   language understood by
                     programmer.



      Example.obj
                     code is converted into a
     (object code)   machine readable form
                     (machine language).
STEP 2:- Linking

                                          The machine readable code
 Example.obj                 Cs.lib
(object code)           (library files)
                                          and library files that are
                                          included in the program are
                                          linked together.



           Example.exe
                                          There by we get an .exe file
         (executable file)                that can be executed.
• STEP 3:- Execution
 Statements in the program will be executed 1 by 1
 And produce the results
THANK - YOU

More Related Content

What's hot

Introduction to Python Programing
Introduction to Python ProgramingIntroduction to Python Programing
Introduction to Python Programing
sameer patil
 
.Net introduction
.Net introduction.Net introduction
.Net introduction
Sireesh K
 
Python Programming - I. Introduction
Python Programming - I. IntroductionPython Programming - I. Introduction
Python Programming - I. Introduction
Ranel Padon
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
sudipv
 
C++ vs python the best ever comparison
C++ vs python the best ever comparison C++ vs python the best ever comparison
C++ vs python the best ever comparison
calltutors
 
Python programming
Python programmingPython programming
Python programming
Prof. Dr. K. Adisesha
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
Nicholas Pringle
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
primeteacher32
 
Programming
ProgrammingProgramming
Programming
monishagoyal4
 
C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?
Christian Nagel
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshop
amptiny
 
The GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation WorldThe GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation World
Radina Matic
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
ASIT Education
 
Type hints in python & mypy
Type hints in python & mypyType hints in python & mypy
Type hints in python & mypy
Anirudh
 
Why Python?
Why Python?Why Python?
Why Python?
Adam Pah
 
Research paper on python by Rj
Research paper on python by RjResearch paper on python by Rj
Research paper on python by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
 
Python for All
Python for All Python for All
Python for All
Pragya Goyal
 
Presentation on java
Presentation on javaPresentation on java
Presentation on java
william john
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Syed Zaid Irshad
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 

What's hot (20)

Introduction to Python Programing
Introduction to Python ProgramingIntroduction to Python Programing
Introduction to Python Programing
 
.Net introduction
.Net introduction.Net introduction
.Net introduction
 
Python Programming - I. Introduction
Python Programming - I. IntroductionPython Programming - I. Introduction
Python Programming - I. Introduction
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
C++ vs python the best ever comparison
C++ vs python the best ever comparison C++ vs python the best ever comparison
C++ vs python the best ever comparison
 
Python programming
Python programmingPython programming
Python programming
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Programming
ProgrammingProgramming
Programming
 
C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshop
 
The GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation WorldThe GNOME way - What can we learn from and within the Open Documentation World
The GNOME way - What can we learn from and within the Open Documentation World
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
 
Type hints in python & mypy
Type hints in python & mypyType hints in python & mypy
Type hints in python & mypy
 
Why Python?
Why Python?Why Python?
Why Python?
 
Research paper on python by Rj
Research paper on python by RjResearch paper on python by Rj
Research paper on python by Rj
 
Python for All
Python for All Python for All
Python for All
 
Presentation on java
Presentation on javaPresentation on java
Presentation on java
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 

Viewers also liked

C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTREC & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
jatin batra
 
basics of c++
basics of c++basics of c++
basics of c++
gourav kottawar
 
Lecture 1-introduction to c
Lecture 1-introduction to cLecture 1-introduction to c
Lecture 1-introduction to c
Muktadir Shoaib
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
Samsil Arefin
 
Intro to cprogramming
Intro to cprogrammingIntro to cprogramming
Intro to cprogramming
skashwin98
 
C, C++, Java, Android
C, C++, Java, AndroidC, C++, Java, Android
C, C++, Java, Android
Mayank Jain
 
Oops and c fundamentals
Oops and c fundamentals Oops and c fundamentals
Oops and c fundamentals
umesh patil
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
shubhra chauhan
 
Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!
PRABHAHARAN429
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
Way2itech
 
Thinking in C/C++, coding in Java
Thinking in C/C++, coding in JavaThinking in C/C++, coding in Java
Thinking in C/C++, coding in Java
anomalizer
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
Subhasis Nayak
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
kamal kotecha
 
Java vs. C/C++
Java vs. C/C++Java vs. C/C++
Java vs. C/C++
Azul Systems Inc.
 
C/C++ History in few slides
C/C++ History in few slides C/C++ History in few slides
History of C/C++ Language
History of C/C++ LanguageHistory of C/C++ Language
History of C/C++ Language
Farid Hilal
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015
Juraj Michálek
 
microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!Sushil Mishra
 

Viewers also liked (20)

C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTREC & C++ Training in Ambala ! BATRA COMPUTER CENTRE
C & C++ Training in Ambala ! BATRA COMPUTER CENTRE
 
basics of c++
basics of c++basics of c++
basics of c++
 
Lecture 1-introduction to c
Lecture 1-introduction to cLecture 1-introduction to c
Lecture 1-introduction to c
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
 
Intro to cprogramming
Intro to cprogrammingIntro to cprogramming
Intro to cprogramming
 
C, C++, Java, Android
C, C++, Java, AndroidC, C++, Java, Android
C, C++, Java, Android
 
Oops and c fundamentals
Oops and c fundamentals Oops and c fundamentals
Oops and c fundamentals
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Thinking in C/C++, coding in Java
Thinking in C/C++, coding in JavaThinking in C/C++, coding in Java
Thinking in C/C++, coding in Java
 
Oops And C++ Fundamentals
Oops And C++ FundamentalsOops And C++ Fundamentals
Oops And C++ Fundamentals
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
Java vs. C/C++
Java vs. C/C++Java vs. C/C++
Java vs. C/C++
 
C/C++ History in few slides
C/C++ History in few slides C/C++ History in few slides
C/C++ History in few slides
 
History of C/C++ Language
History of C/C++ LanguageHistory of C/C++ Language
History of C/C++ Language
 
C vs c++
C vs c++C vs c++
C vs c++
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015
 
microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!microprocessor 8086 lab manual !!
microprocessor 8086 lab manual !!
 
Mp lab manual
Mp lab manualMp lab manual
Mp lab manual
 

Similar to C++ l 1

C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
jatin batra
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
Ainuddin Yousufzai
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
Sireesh K
 
Unit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptxUnit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptx
shashiden1
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
Shujaat Abbas
 
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
AKR Education
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
Danielle780357
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
CoolGamer16
 
Programming using C++ - slides.pptx
Programming using C++ - slides.pptxProgramming using C++ - slides.pptx
Programming using C++ - slides.pptx
HeadoftheDepartment
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
Michael Heron
 
Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1
University College of Engineering Kakinada, JNTUK - Kakinada, India
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
Dilawar Khan
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
AnassElHousni
 
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...
bhargavi804095
 
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...
bhargavi804095
 
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
MayurWagh46
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 

Similar to C++ l 1 (20)

C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
 
Oops index
Oops indexOops index
Oops index
 
Unit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptxUnit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptx
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
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
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
Programming using C++ - slides.pptx
Programming using C++ - slides.pptxProgramming using C++ - slides.pptx
Programming using C++ - slides.pptx
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
 
Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1
 
Intro to .NET and Core C#
Intro to .NET and Core C#Intro to .NET and Core C#
Intro to .NET and Core C#
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
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 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 

Recently uploaded

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

C++ l 1

  • 2. This lecture • Five reasons to learn C/C++ • History of C and C++ • Aims of c and c++ • Procedural languages & oo languages • Similarities between c & c++ • Differences between c & c++ • Compilation, Linkage and Running • Packages • Functions
  • 3. Five reasons to learn C & C++? 1. (Still) utilised in industry Why so popular? (after so long) 2. Choose the appropriate tool for the task Understand the Java vs C/C++ differences 3. More programming practice Much is common across languages 4. Much is VERY similar to Java Easier to learn: much will be familiar to you 5. Useful for other modules And projects
  • 4. The history of C/C++ In Bell Labs, ‘B’ language created, based on BCPL 1971-1973 : Dennis Ritchie extended ‘B’ to create ‘C’ Main features of C developed over this time 1973-1980 : New features were added C needed to be standardised! 1979 : Bjarne Stroustrup (Bell labs) extended C to make ‘C with classes’ 1982 : ‘K&R’ (Kernighan and Ritchie) unofficial C ‘standard’ 1983 : ‘C with classes’ renamed C++, features still being added 1989 : ANSI standard C (started in 1983!) (=> ISO standard in 1990) Differs in some ways from K&R ‘C’ and is often named ‘C89’ Together with Amendment 1, forms ‘C’ element of ‘C++’ 1990s : C++ took centre stage (Standardisation progressing) 1994 : Standard Template Library makes it into the ISO standard C++ (Some template implementation arguments ongoing as late as 2003) 1995 : Java released by Sun 1998 : ISO standard C++ ratified (C++98) 1999 : New version of C standard (C99) (Differs from C++) We will concentrate on C89 and C++
  • 5. The aims of C and C++ • C came first : with specific design aims • Ability to write low-level code (e.g. O/S) • Speed and efficiency • Ease for programmers • Rather than non-programmers • C++ grew from C : kept some similar aims
  • 6. Is C++ O.O. or Procedural • C is procedural (no classes, hard to do OO) • C++ will let you do either • You CAN write procedural C++ • Or you can write object oriented C++ • Or mix both together (often a bad idea) • C++ also adds a lot of non-OO features • e.g. templates, new/delete, operator overloading, … • Useful for procedural programming as well
  • 7. Object oriented vs Procedural • My view: • Procedural or object oriented are ways of thinking • How do you want to think of your program? • A lot of communicating objects • Or ‘do this then this then this…’ • Whichever you use: (within a thread) • Functions are still called one at a time • And operations are executed one at a time
  • 8. OO – a good or bad thing? • Object oriented techniques can hide some of the complexity (a good thing?) • Make it easier to understand a program (?) • Make it easier to structure a large program (?) • Some facilities hide what is actually happening, to simplify things (bad?) • We are going to look at C/C++, not object oriented design/programming • Many courses start with object oriented C++
  • 9. Similarities • same built-in data types • same compiler preprocessor • handles #include & #define • same built-in operators on primitive types (+-/*……)
  • 10. Similarities (cont.) • Same built-in control structures • if, for, while, switch …. • must have a function names “main” to determine where the program starts • functions are defined the same way • programs can be split up into separate files
  • 11. Differences • in C all code exists in function and the paradigm is that you manipulate data with functions • in C++ classes are used to model the behavior of data objects, behavior is represented by functions and those functions are used to modify the object’s data
  • 12. Differences (cont.) • in C a struct is used to make an aggregate type and cannot have associated functions • in C++ struct there may be associated (part of the struct) functions to process the data • in C I/O is accomplished via library functions, in C++ it is done by using object methods.
  • 13. Differences (cont.) • C++ has function overloading (two functions may have the same name), in C function names must be unique. • C++ has operator overloading (operators can be redefined to do other things) • C++ uses “nbew” and “delete” for dynamic memory management, C uses “malloc” and “free”
  • 14. Machine Language • A system of instructions and data directly executed by a computer’s central processing unit • Machine language is represented by bits (binary digits) i.e. 0s and 1s. • Example: 00111010
  • 15. Assembly Language • More readable version of machine language • Uses mnemonic codes to refer to machine code instructions • Example: INC A (Increment Register A), DEC B (Decrement Register B)
  • 16. High Level Language • Easier to use and more portable across platforms • Represented using English like statements • Examples: Basic, Fortran, Cobol, C.
  • 17. Compilation and Execution of C++ programs STEP 1:- Compilation Example.cpp This code is written in c++ (source code) language understood by programmer. Example.obj code is converted into a (object code) machine readable form (machine language).
  • 18. STEP 2:- Linking The machine readable code Example.obj Cs.lib (object code) (library files) and library files that are included in the program are linked together. Example.exe There by we get an .exe file (executable file) that can be executed.
  • 19. • STEP 3:- Execution Statements in the program will be executed 1 by 1 And produce the results