SlideShare a Scribd company logo
Lecture 01-02
Computer Programming
1
2
• Computer programming
• Why programming?
• Instructions andProgram
• Low level, High level and Middle level programming languages
• Source Code and Object Code
• Language Translators
• Compiler
• Interpreter
• Assembler
• Why language translators?
3
• Difference between compiler and interpreter
• Bug and Debugging
4
5
• It is the process of giving instructions (commands) to the computer to do a
meaningful task.
• It is an act of teaching the computer on how to do a task.
• The art and science of creating instructions for a computer to follow.
• Creating a sequence of instructions to enable the computer to do something.
6
7
electronic• Computer is just a dumb machine made up of different
components. It is like a box which cannot do anything by itself.
• It is the user who tells the computer “what it has to do?”
• If we need our computer to perform some task, we first have to teach the
computer in detail “how it will accomplish that task?”
• Once the computer is taught about a particular task, it will completely obey
it but cannot do anything that it is not taught to.
8
• Like the humans, we can teach the computer through communicating with it
using a particularlanguage.
• The language that computer understands is machine language, also called
as binary language. Machine language is the language of 0s and 1s.
• We give detailed instructions to the computer to solve a particular task.
Programming is the term that refers to teaching, instructing or giving
commands to thecomputer.
9
• Programming is more about problem solving skills than writing the code
itself.
• Programming teaches you how to understand, analyze and solve the
problems. It enhances your analytical reasoning abilities and helps you cope
with daily real life problems as well.
• Hence learning to program is important because it develops analytical and
problem solvingabilities.
10
• The person who gives the instructions (commands) to the computer is
known as theprogrammer.
• Aperson who designs and writes computer programs.
11
DOTHIS!
12
• Instruction is any command given to the computer.
• For example:
1) Add two variables Aand B
2) Display result
3) Read file
• Each of these is the individual instruction to the computer.
13
NOWDOTHIS!
NOWDOTHIS!
NOWDOTHIS!
NOWDOTHIS!
NOWDOTHIS!
14
• Program is a set (collection) of instruction to do a meaningful task.
• Asequence of instructions that are interpreted and executed by a computer.
It can be made of a single or hundred of instructions.
• For example: In order to teach the computer on how to calculate average of
three numbers? We need to give multiple instructions to the computer to do
the task.
15
Instruction1: Get first number from the user and store it in Avariable
Instruction2: Get second number from the user and store it in B variable
Instruction3:Get third number from the user and store it in Cvariable
Instruction4:Add A,B,Cand store the result in SUMvariable
Instruction5: Divide SUMby 3 and store result in AVGvariable
Instruction6:Display AVGvariable
• Instructions 1-6 are used to solve a single task. This collection of instruction
is known as a program.
16
17
• Aprogramming language is an artificial language designed to
communicate instructions to a computer.
• Aprogramming language is a notation for writing programs.
• Avocabulary and set of grammatical rules for instructing a computer to
perform specifictasks.
18
• Each language has a unique set of keywords (special words that it
understands) and a special syntax (format) for organizing program
instructions.
• There are many programming languages. For example:
• GWBasic
• C
• C++
• JAVA
• Pascal
• COBOL
• Python
• C#
19
• There are three types of programming languages:
20
Machine(Computer) Human(Programmer)
LANGUAGE
Alanguage which is closer to machine (computer)
21
• Alow level language is one which is closer to the machine (computer).
• It is easier for machines to understand and difficult for humans to
understand.
• It is faster in execution as compared to high and middle level languages.
22
• Two of the types of low level languages are:
23
• It is one of the low level language.
• It is the language of 0s and 1s.
• Machine languages are the only languages directly understood by the
computers.
• While easily understood by computers, machine languages are almost
impossible for humans to use because they consist entirely of numbers (0s
and 1s).
• It is the native language of the machines (computers).
• Here all the instructions are written as code of binary
sequence. For example:
• In order to do addition, the code is: 10010001
• In order to decrement a number by one, the code is: 11011011
• In order to move data from one place to another, the code is:
 10000111
24
25
• There are hundreds of instructions and each instruction has a binary
code.
• Is it possible to remember all the codes of hundreds of instruction?
• Obviously not! Hence machine language almost impossible to
understand.
26
• Machine language program example:
10010010
11001010
01001010
11110101
00000101
00101000
11101010
10101010
27
• Assembly language is same as machine language but uses English like
words to represent individual operations.
• For example: Instead of binary codes it uses : ADD,MOV,SUB,INC
• Assembly language is also a low-level language.
• It is easier than the machine language but still it is very difficult to control
a larger program using assembly.
28
• As assembly language contains English like words, which will not be
understood by the computer (because it only understands 0s and 1s)
• Atranslator first converts the assembly language program into machine
language program.
• Translator used with assembly language is called Assembler.
29
• Assembly language program example:
MVI A, 05h
MVI B, 9Ah
ADDB
INC A
STA
8200
h HLT
30
Machine(Computer) Human(Programmer)
LANGUAGE
Alanguage which is closer to human (programmer)
31
• Ahigh level language is one which is closer to the human
(programmer).
• It is easier for humans to understand and difficult for machines
to understand.
• It is slower in execution as compared to low level languages.
32
• Like assembly language, it also uses English like words for the
operations.
• For example: for, if, else, break, continue, while,include,
using, import
• It is more easier than assembly language.
33
• Some of the high level programming languages are:
• GWBasic
• C++
• JAVA
• Pascal
• COBOL
• Python
• C#
• VisualBasic
• J#
• Ruby
• PHP
34
• High level language programexample:
int main()
{
int a = 5;
int b = 6;
if(a > b)
cout<<“First number is greater.”;
else
cout<<“Second number is greater.”;
}
35
Machine(Computer) Human(Programmer)
LANGUAGE
Alanguage which is some how closer to machine as well as human
36
• Amiddle level language is one which is closer to machine
(computer) as well as to human (programmer).
• Alanguage that has the features of both low level and high
level languages.
• More formally, a high level language that allows you to write
low level programs in it is called as middle level language.
37
• Some of the middle level programming languages are:
• C
• IBMPL/S(ProgrammingLanguage/Systems)
• BCPL(BasicCombinedProgramming Language)
• BLISS(Bill'sLanguageforImplementingSystem Software)
38
Source Code
• The set of instructions written in any
language other than machine language is
called as sourcecode.
• It is not directly understood by the
machine (computer).
Object Code
• The set of instructions written in
machine language is called as object
code. It is also known as machinecode.
• It is the only code which is directly
understood by the machine (computer).
39
Source Code
• It is in the form of text.
• It is human readable.
• It is generated by human (programmer).
• It is input to the language translator.
Object Code
• It is in the form of binary numbers.
• It is machine (computer) readable.
• It is generated by the language translator.
• It is the output of the language translator.
40
41
• Language translator is a program that converts the source code
in to the object code.
Source Code Object Code
CONVERT
Language Translator
Translator
42
• Computer only understands object code (machine code).
• It does not understand any source code.
• There must be a program that converts source code in to the object code
so that the computer can understand it.
• The language translator is one which does this job.
• The programmer writes the source code and then translator converts it
in machine readable format (object code).
43
• There are three types of language translator:
44
• Assembler is the language translator that converts assembly
language code in to the object code (machine code).
Assembly
Source Code
Object Code
CONVERT
Assembler
45
• Compiler is the language translator that converts high level
language code in to the object code (machine code).
• It converts the whole code at a time.
High-Level
Source Code
Object Code
CONVERT
Compiler
46
Line 1 : Instruction 1
Line 2: Instruction 2
Line 3: Instruction 3
Line 4: Instruction 4
Line 5 : Instruction 5
Program
Line 1 : Instruction 1
Line 2: Instruction 2
Line 3: Instruction 3
Line 4: Instruction 4
Line 5 : Instruction 5
Readwhole Program
Convertwhole
programintoobject
code
Execute
1 2 3 4
47
• Interpreter is the language translator that converts high level
language code in to the object code (machine code).
• It converts the code line by line.
High-Level
Source Code
Object Code
CONVERT
Interpreter
48
Line 1 : Instruction 1
Line 2: Instruction 2
Line 3: Instruction 3
Line 4: Instruction 4
Line 5 : Instruction 5
Program
1
ReadLine1
ReadLine2
ReadLine3
ReadLine4
ReadLine5
Convertintoobject code
Convertintoobject code
Convert in to object code
Convert in to object code
Convertintoobject code
Execute
Execute
Execute
Execute 2
Execute 3
4
5
6
 Compiler
• It converts whole code at a time.
• It is faster.
• Requires more memory.
• Errors are displayed after entire program
is checked.
• Example: C, C++, JAVA.
 Interpreter
• It converts the code line by line.
• It is slower.
• Requires less memory.
• Errors are displayed for every instruction
interpreted (if any).
• Example: GW BASIC, Ruby, Python
49
Bu
g
50
51
• An error or defect occurred inside a computer program or
hardware that causes it to produce an incorrect or unexpected
result, or to behave in unintended ways is called as a bug.
• Most of the bugs arise from mistakes and errors made by
programmer in sourcecode.
52
• The term bug was used by Grace Hopper in 1946.
• Hopper used to work on Mark II computer, there some error
occurred in the system. The cause of the error was a moth
(bug) trapped in a relay creating short circuit.
• That caused the term bug to be coined.
53
54
• It is the process of finding and fixing the bugs (errors) in the
program.
• It is the process of removing errors.
• The programmer manually does this by examining the source
code.

More Related Content

What's hot

High level languages representation
High level languages representationHigh level languages representation
High level languages representation
gaurav jain
 
Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...
SHUBHAM PATIDAR FISHERIES ADDAA
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpretersRAJU KATHI
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languages
actanimation
 
Machine language
Machine languageMachine language
Machine languageRipal Dhruv
 
Computer languages
Computer languagesComputer languages
Computer languages
Buxoo Abdullah
 
Computer languages
Computer languagesComputer languages
Computer languages
AqdasNoor
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
Syed Zaid Irshad
 
FIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer LanguagesFIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer Languages
raksharao
 
Languages in computer
Languages in computerLanguages in computer
Languages in computer
The University of Lahore
 
COMPUTER LANGUAGES AND PROGRAMMING
COMPUTER LANGUAGES AND PROGRAMMINGCOMPUTER LANGUAGES AND PROGRAMMING
COMPUTER LANGUAGES AND PROGRAMMING
ABHINAV SINGH
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
Noel Malle
 
Computer Languages
Computer Languages Computer Languages
Computer Languages
Anjana Mohanan
 
Computer languages
Computer languagesComputer languages
Computer languages
ABHINAV SINGH
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer langkapil078
 
Lecture1
Lecture1Lecture1
Lecture1
Pagal Bacha
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9nahomyitbarek
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
NaqashAhmad14
 

What's hot (20)

High level languages representation
High level languages representationHigh level languages representation
High level languages representation
 
Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpreters
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languages
 
Computer Programming - Lecture 1
Computer Programming - Lecture 1Computer Programming - Lecture 1
Computer Programming - Lecture 1
 
Machine language
Machine languageMachine language
Machine language
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
Introduction to programming languages
Introduction to programming languagesIntroduction to programming languages
Introduction to programming languages
 
FIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer LanguagesFIT-Unit3 chapter2- Computer Languages
FIT-Unit3 chapter2- Computer Languages
 
Languages in computer
Languages in computerLanguages in computer
Languages in computer
 
COMPUTER LANGUAGES AND PROGRAMMING
COMPUTER LANGUAGES AND PROGRAMMINGCOMPUTER LANGUAGES AND PROGRAMMING
COMPUTER LANGUAGES AND PROGRAMMING
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Computer Languages
Computer Languages Computer Languages
Computer Languages
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer lang
 
Lecture1
Lecture1Lecture1
Lecture1
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 

Similar to C++ programming languages lectures

Language translators Of Programming in Computer science
Language translators Of Programming in Computer scienceLanguage translators Of Programming in Computer science
Language translators Of Programming in Computer science
RaianaTabitha
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
PmarkNorcio
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
AttaullahRahimoon
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
imtiazalijoono
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
Faiza Gull
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptx
crAmth
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
MohammedMohammed578197
 
sege.pdf
sege.pdfsege.pdf
sege.pdf
SegezzBrian
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming
VanessaBuensalida
 
programming.pptx
programming.pptxprogramming.pptx
programming.pptx
DarianElmyra
 
X-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdfX-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdf
Alefya1
 
C Programming Lecture 1 - Introduction to C.pptx
C Programming Lecture 1 - Introduction to C.pptxC Programming Lecture 1 - Introduction to C.pptx
C Programming Lecture 1 - Introduction to C.pptx
Murali M
 
Computer programming
Computer programmingComputer programming
Computer programming
Mohamed Asarudeen
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
Learn By Watch
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
zaheeriqbal41
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
Christ Association
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer langkapil078
 

Similar to C++ programming languages lectures (20)

Language translators Of Programming in Computer science
Language translators Of Programming in Computer scienceLanguage translators Of Programming in Computer science
Language translators Of Programming in Computer science
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptx
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
sege.pdf
sege.pdfsege.pdf
sege.pdf
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming
 
programming.pptx
programming.pptxprogramming.pptx
programming.pptx
 
X-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdfX-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdf
 
C Programming Lecture 1 - Introduction to C.pptx
C Programming Lecture 1 - Introduction to C.pptxC Programming Lecture 1 - Introduction to C.pptx
C Programming Lecture 1 - Introduction to C.pptx
 
Computer programming
Computer programmingComputer programming
Computer programming
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer lang
 

Recently uploaded

Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 

Recently uploaded (20)

Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 

C++ programming languages lectures

  • 2. 2 • Computer programming • Why programming? • Instructions andProgram • Low level, High level and Middle level programming languages • Source Code and Object Code • Language Translators • Compiler • Interpreter • Assembler • Why language translators?
  • 3. 3 • Difference between compiler and interpreter • Bug and Debugging
  • 4. 4
  • 5. 5 • It is the process of giving instructions (commands) to the computer to do a meaningful task. • It is an act of teaching the computer on how to do a task. • The art and science of creating instructions for a computer to follow. • Creating a sequence of instructions to enable the computer to do something.
  • 6. 6
  • 7. 7 electronic• Computer is just a dumb machine made up of different components. It is like a box which cannot do anything by itself. • It is the user who tells the computer “what it has to do?” • If we need our computer to perform some task, we first have to teach the computer in detail “how it will accomplish that task?” • Once the computer is taught about a particular task, it will completely obey it but cannot do anything that it is not taught to.
  • 8. 8 • Like the humans, we can teach the computer through communicating with it using a particularlanguage. • The language that computer understands is machine language, also called as binary language. Machine language is the language of 0s and 1s. • We give detailed instructions to the computer to solve a particular task. Programming is the term that refers to teaching, instructing or giving commands to thecomputer.
  • 9. 9 • Programming is more about problem solving skills than writing the code itself. • Programming teaches you how to understand, analyze and solve the problems. It enhances your analytical reasoning abilities and helps you cope with daily real life problems as well. • Hence learning to program is important because it develops analytical and problem solvingabilities.
  • 10. 10 • The person who gives the instructions (commands) to the computer is known as theprogrammer. • Aperson who designs and writes computer programs.
  • 12. 12 • Instruction is any command given to the computer. • For example: 1) Add two variables Aand B 2) Display result 3) Read file • Each of these is the individual instruction to the computer.
  • 14. 14 • Program is a set (collection) of instruction to do a meaningful task. • Asequence of instructions that are interpreted and executed by a computer. It can be made of a single or hundred of instructions. • For example: In order to teach the computer on how to calculate average of three numbers? We need to give multiple instructions to the computer to do the task.
  • 15. 15 Instruction1: Get first number from the user and store it in Avariable Instruction2: Get second number from the user and store it in B variable Instruction3:Get third number from the user and store it in Cvariable Instruction4:Add A,B,Cand store the result in SUMvariable Instruction5: Divide SUMby 3 and store result in AVGvariable Instruction6:Display AVGvariable • Instructions 1-6 are used to solve a single task. This collection of instruction is known as a program.
  • 16. 16
  • 17. 17 • Aprogramming language is an artificial language designed to communicate instructions to a computer. • Aprogramming language is a notation for writing programs. • Avocabulary and set of grammatical rules for instructing a computer to perform specifictasks.
  • 18. 18 • Each language has a unique set of keywords (special words that it understands) and a special syntax (format) for organizing program instructions. • There are many programming languages. For example: • GWBasic • C • C++ • JAVA • Pascal • COBOL • Python • C#
  • 19. 19 • There are three types of programming languages:
  • 21. 21 • Alow level language is one which is closer to the machine (computer). • It is easier for machines to understand and difficult for humans to understand. • It is faster in execution as compared to high and middle level languages.
  • 22. 22 • Two of the types of low level languages are:
  • 23. 23 • It is one of the low level language. • It is the language of 0s and 1s. • Machine languages are the only languages directly understood by the computers. • While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers (0s and 1s).
  • 24. • It is the native language of the machines (computers). • Here all the instructions are written as code of binary sequence. For example: • In order to do addition, the code is: 10010001 • In order to decrement a number by one, the code is: 11011011 • In order to move data from one place to another, the code is:  10000111 24
  • 25. 25 • There are hundreds of instructions and each instruction has a binary code. • Is it possible to remember all the codes of hundreds of instruction? • Obviously not! Hence machine language almost impossible to understand.
  • 26. 26 • Machine language program example: 10010010 11001010 01001010 11110101 00000101 00101000 11101010 10101010
  • 27. 27 • Assembly language is same as machine language but uses English like words to represent individual operations. • For example: Instead of binary codes it uses : ADD,MOV,SUB,INC • Assembly language is also a low-level language. • It is easier than the machine language but still it is very difficult to control a larger program using assembly.
  • 28. 28 • As assembly language contains English like words, which will not be understood by the computer (because it only understands 0s and 1s) • Atranslator first converts the assembly language program into machine language program. • Translator used with assembly language is called Assembler.
  • 29. 29 • Assembly language program example: MVI A, 05h MVI B, 9Ah ADDB INC A STA 8200 h HLT
  • 31. 31 • Ahigh level language is one which is closer to the human (programmer). • It is easier for humans to understand and difficult for machines to understand. • It is slower in execution as compared to low level languages.
  • 32. 32 • Like assembly language, it also uses English like words for the operations. • For example: for, if, else, break, continue, while,include, using, import • It is more easier than assembly language.
  • 33. 33 • Some of the high level programming languages are: • GWBasic • C++ • JAVA • Pascal • COBOL • Python • C# • VisualBasic • J# • Ruby • PHP
  • 34. 34 • High level language programexample: int main() { int a = 5; int b = 6; if(a > b) cout<<“First number is greater.”; else cout<<“Second number is greater.”; }
  • 35. 35 Machine(Computer) Human(Programmer) LANGUAGE Alanguage which is some how closer to machine as well as human
  • 36. 36 • Amiddle level language is one which is closer to machine (computer) as well as to human (programmer). • Alanguage that has the features of both low level and high level languages. • More formally, a high level language that allows you to write low level programs in it is called as middle level language.
  • 37. 37 • Some of the middle level programming languages are: • C • IBMPL/S(ProgrammingLanguage/Systems) • BCPL(BasicCombinedProgramming Language) • BLISS(Bill'sLanguageforImplementingSystem Software)
  • 38. 38 Source Code • The set of instructions written in any language other than machine language is called as sourcecode. • It is not directly understood by the machine (computer). Object Code • The set of instructions written in machine language is called as object code. It is also known as machinecode. • It is the only code which is directly understood by the machine (computer).
  • 39. 39 Source Code • It is in the form of text. • It is human readable. • It is generated by human (programmer). • It is input to the language translator. Object Code • It is in the form of binary numbers. • It is machine (computer) readable. • It is generated by the language translator. • It is the output of the language translator.
  • 40. 40
  • 41. 41 • Language translator is a program that converts the source code in to the object code. Source Code Object Code CONVERT Language Translator Translator
  • 42. 42 • Computer only understands object code (machine code). • It does not understand any source code. • There must be a program that converts source code in to the object code so that the computer can understand it. • The language translator is one which does this job. • The programmer writes the source code and then translator converts it in machine readable format (object code).
  • 43. 43 • There are three types of language translator:
  • 44. 44 • Assembler is the language translator that converts assembly language code in to the object code (machine code). Assembly Source Code Object Code CONVERT Assembler
  • 45. 45 • Compiler is the language translator that converts high level language code in to the object code (machine code). • It converts the whole code at a time. High-Level Source Code Object Code CONVERT Compiler
  • 46. 46 Line 1 : Instruction 1 Line 2: Instruction 2 Line 3: Instruction 3 Line 4: Instruction 4 Line 5 : Instruction 5 Program Line 1 : Instruction 1 Line 2: Instruction 2 Line 3: Instruction 3 Line 4: Instruction 4 Line 5 : Instruction 5 Readwhole Program Convertwhole programintoobject code Execute 1 2 3 4
  • 47. 47 • Interpreter is the language translator that converts high level language code in to the object code (machine code). • It converts the code line by line. High-Level Source Code Object Code CONVERT Interpreter
  • 48. 48 Line 1 : Instruction 1 Line 2: Instruction 2 Line 3: Instruction 3 Line 4: Instruction 4 Line 5 : Instruction 5 Program 1 ReadLine1 ReadLine2 ReadLine3 ReadLine4 ReadLine5 Convertintoobject code Convertintoobject code Convert in to object code Convert in to object code Convertintoobject code Execute Execute Execute Execute 2 Execute 3 4 5 6
  • 49.  Compiler • It converts whole code at a time. • It is faster. • Requires more memory. • Errors are displayed after entire program is checked. • Example: C, C++, JAVA.  Interpreter • It converts the code line by line. • It is slower. • Requires less memory. • Errors are displayed for every instruction interpreted (if any). • Example: GW BASIC, Ruby, Python 49
  • 51. 51 • An error or defect occurred inside a computer program or hardware that causes it to produce an incorrect or unexpected result, or to behave in unintended ways is called as a bug. • Most of the bugs arise from mistakes and errors made by programmer in sourcecode.
  • 52. 52 • The term bug was used by Grace Hopper in 1946. • Hopper used to work on Mark II computer, there some error occurred in the system. The cause of the error was a moth (bug) trapped in a relay creating short circuit. • That caused the term bug to be coined.
  • 53. 53
  • 54. 54 • It is the process of finding and fixing the bugs (errors) in the program. • It is the process of removing errors. • The programmer manually does this by examining the source code.