SlideShare a Scribd company logo
1 of 35
PRINCIPLES OF PROGRAMMING
CP 111 Lecture No. 2
OUTLINE
● Problem solving techniques and strategies,
● Understanding problem solving steps such as
○ Problem analysis,
○ design, implement, and
○ code test.
● Simple Input/ Output statements
● Escape codes,
● Programming Errors: syntax, runtime, and logical.
● Describing syntax and semantics
Basic Concepts:
Problem solving techniques and strategies
● A computer cannot solve a problem on its own.
● One has to provide step by step solutions of the problem to the computer.
● In fact, the task of problem solving is not that of the computer.
● It is the programmer who has to write down the solution to the problem in terms
of simple operations which the computer can understand and execute.
Problem solving techniques and strategies….
● Procedures (Steps Involved in Problem Solving)
● In order to solve a problem by the computer, one has to pass though certain
stages or steps.
1. Understanding the problem
2. Analyzing the problem
3. Developing the solution (Design)
4. Coding and implementation.
Problem solving techniques and strategies….
1. Understanding the problem:
● Here we try to understand the problem to be solved in totally.
● Before with the next stage or step, we should be absolutely sure about the
objectives of the given problem.
2. Analyzing the problem:
● After understanding thoroughly the problem to be solved, we look different ways
of solving the problem and evaluate each of these methods.
● The idea here is to search an appropriate solution to the problem under
consideration.
● The end result of this stage is a broad overview of the sequence of operations
that are to be carried out to solve the given problem.
Problem solving techniques and strategies….
3. Developing the solution:
● Here the overview of the sequence of operations that was the result of analysis
stage is expanded to form a detailed step by step solution to the problem under
consideration.
4. Coding and implementation:
● The last stage of the problem solving is the conversion of the detailed sequence
of operations in to a language that the computer can understand.
● Here each step is converted to its equivalent instruction or instructions in the
computer language that has been chosen for the implantation.
Problem solving techniques and strategies….
What is Algorithm?
Definition
● A set of sequential steps usually written in Ordinary Language to solve a given
problem.
It may be possible to solve to problem in more than one ways, resulting in more
than one algorithm.
● The choice of various algorithms depends on the factors like reliability,
accuracy and easy to modify.
● The most important factor in the choice of algorithm is the time requirement to
execute it
Simple Input/ Output statements
● cin and cout are two predefined C++ objects which represent standard input
and output stream.
● The standard output stream represents the screen, while the standard input
stream represents the keyboard.
● These objects are members of iostream class.
● Hence the header file <iostream.h> should be included in the beginning of all
C++ programs.
Escape code
Escape codes
● Escape codes are used to represent characters that are difficult to express
otherwise in the source code.
For instance a tab (t).
● Escape codes all start with a backslash ().
● Escape codes can also be used to express octal (base-8) or hexadecimal (base-
16) numbers. An octal number can be used like this: 10 (backslash followed by
a number.)
● A hexadecimal number can be used like this: xF0 (a backslash followed by an x
and the number.)
Escape code….
Escape codes examples
Programming Errors
Error is an illegal operation performed by the user which results in abnormal
working of the program.
● Programming errors often remain undetected until the program is compiled or
executed.
● Some of the errors inhibit the program from getting compiled or executed.
● Thus errors should be removed before compiling and executing.
Programming Errors
Types of program errors
● We distinguish between the following types of errors:
1. Syntax errors: errors due to the fact that the syntax of the language is not
respected.
2. Semantic errors: errors due to an improper use of program statements.
3. Logical errors: errors due to the fact that the specification is not respected.
From the point of view of when errors are detected,
● We distinguish:
1. Compile time errors: syntax errors and static semantic errors indicated by the
compiler.
2. Runtime errors: dynamic semantic errors, and logical errors, that cannot be
detected by the compiler (debugging).
Syntax, semantics, and pragmatics
● Every programming language has syntax, semantics, and pragmatics.
● We have seen that natural languages also have syntax and semantics, but
pragmatics is unique to programming languages.
Syntax, semantics, and pragmatics
● A programming language’s syntax is concerned with the form of programs
○ how expressions, commands, declarations, and other constructs must be arranged
to make a well-formed program.
● A programming language’s semantics is concerned with the meaning of
programs:
○ how a well-formed program may be expected to behave when executed on a
computer.
● A programming language’s pragmatics is concerned with the way in which the
language is intended to be used in practice.
Syntax, semantics, and pragmatics
Pragmatics is the third general area of language description, referring to practical aspects of how
constructs and features of a language may be used to achieve various objectives.
● Consider, for example, the syntax, semantics and pragmatics of an assignment statement.
As a syntactic construct, an assignment statement may consist of a variable and an expression
(themselves syntactic constructs), separated by the token = as an assignment operator. Semantically,
the variable denotes a location in computer memory, while the expression denotes computation of a
value based on the contents of memory.
● Overall, the semantics of assignment is to perform the expression evaluation based on current
memory contents and then update the value stored in the particular location corresponding to the
variable. But what is often most interesting to programmers is really the pragmatics, that is, what
assignment statements are useful for.
● There are many possibilities: to set up a temporary variable for the value of an expression that is
needed more than once, to communicate values from one part of a program to another, to modify
part of a data structure, or to set successive values of a variable used in some iterative
computation.
Programming Errors….
Syntax errors
Programming Errors….
Semantic errors
Programming Errors….
Logical errors
An important note about compilers:
● Modern compilers typically are very accurate in identifying syntax errors and
will help you enormously in correcting your code.
● However, compilers often present two difficult problems for new programmers:
a) They frequently can miss reporting an actual error on one line but get “thrown off
track,” then report errors on subsequent lines that are not truly errors; the compiler
may then also display error messages which are incorrect; and
b) After encountering one true syntax error, compilers often generate many incorrect
syntax error messages; again, the compiler has been “thrown off track” by a
particular error. Why does this occur? Basically, because a compiler is a very
complex and sophisticated language-processing program, and no computer
program can analyze any language as well as a human being can at this point in
time.
Errors detected by the compiler and runtime errors
Errors detected by the compiler and runtime errors
What is debugging ?
Debugging:
● Is the process of identifying and removing errors from computer hardware or
software.
or
● is the process of detecting and removing of existing and potential errors (also
called as 'bugs') in a software code that can cause it to behave unexpectedly or
crash.
● To prevent incorrect operation of a software or system, debugging is used to
find and resolve bugs or defects
What is debugging ?....
● Debugger: is a computer program that assists in the detection and correction of
errors in other computer programs.
● A debugger is a computer program used by programmers to test and debug a
target program.
● Debuggers may use instruction-set simulators, rather than running a program
directly on the processor to achieve a higher level of control over its execution.
Techniques for detecting errors (debugging)
• If the testing phase signals the presence of logical errors, or if we are not able to detect the cause for a
runtime error, it is necessary to debug the program.
• There are two ways in which we can obtain information that is helpful for debugging a program:
1. By inserting output statements in the code;
2. By executing the program by means of a debugger.
Questions?

More Related Content

What's hot

Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principlesNIKANOR THOMAS
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CPrabu U
 
INTRODUCTION TO C++, Chapter 1
INTRODUCTION TO C++, Chapter 1INTRODUCTION TO C++, Chapter 1
INTRODUCTION TO C++, Chapter 1Mubarek Kurt
 
Principles of programming
Principles of programmingPrinciples of programming
Principles of programmingRob Paok
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languagesFrankie Jones
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1Namrah Erum
 
Program design and problem solving techniques
Program design and problem solving techniquesProgram design and problem solving techniques
Program design and problem solving techniquesDokka Srinivasu
 
Decision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsDecision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsPrabu U
 
Coding principles
Coding principles Coding principles
Coding principles DevAdnani
 
Computer programming all chapters
Computer programming all chaptersComputer programming all chapters
Computer programming all chaptersIbrahim Elewah
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life CycleFrankie Jones
 
Planning to computer program(southeast university)
Planning to computer program(southeast university)Planning to computer program(southeast university)
Planning to computer program(southeast university)Arup deb nath
 

What's hot (20)

Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principles
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
INTRODUCTION TO C++, Chapter 1
INTRODUCTION TO C++, Chapter 1INTRODUCTION TO C++, Chapter 1
INTRODUCTION TO C++, Chapter 1
 
The Programming Process
The Programming ProcessThe Programming Process
The Programming Process
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Principles of programming
Principles of programmingPrinciples of programming
Principles of programming
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Algorithms - Introduction to computer programming
Algorithms - Introduction to computer programmingAlgorithms - Introduction to computer programming
Algorithms - Introduction to computer programming
 
Computer
ComputerComputer
Computer
 
Programming and problem solving with c++, 3rd edition
Programming and problem solving with c++, 3rd editionProgramming and problem solving with c++, 3rd edition
Programming and problem solving with c++, 3rd edition
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languages
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
 
Program design and problem solving techniques
Program design and problem solving techniquesProgram design and problem solving techniques
Program design and problem solving techniques
 
Decision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsDecision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, Strings
 
Coding principles
Coding principles Coding principles
Coding principles
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Computer programming all chapters
Computer programming all chaptersComputer programming all chapters
Computer programming all chapters
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
Planning to computer program(southeast university)
Planning to computer program(southeast university)Planning to computer program(southeast university)
Planning to computer program(southeast university)
 

Similar to Computer programing 111 lecture 2

C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfMMRF2
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)nharsh2308
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++Seble Nigussie
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxSherinRappai1
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxSherinRappai
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5Alok Jain
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overviewamudha arul
 
COM1407: Structured Program Development
COM1407: Structured Program Development COM1407: Structured Program Development
COM1407: Structured Program Development Hemantha Kulathilake
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptxPmarkNorcio
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdflailoesakhan
 

Similar to Computer programing 111 lecture 2 (20)

C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
grade 10 2023.pptx
grade 10 2023.pptxgrade 10 2023.pptx
grade 10 2023.pptx
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
COM1407: Structured Program Development
COM1407: Structured Program Development COM1407: Structured Program Development
COM1407: Structured Program Development
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
01CHAP_1.PPT
01CHAP_1.PPT01CHAP_1.PPT
01CHAP_1.PPT
 
Introduction to Programming.docx
Introduction to Programming.docxIntroduction to Programming.docx
Introduction to Programming.docx
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 
C programming
C programmingC programming
C programming
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdf
 

More from ITNet

lecture 8 b main memory
lecture 8 b main memorylecture 8 b main memory
lecture 8 b main memoryITNet
 
lecture 9.pptx
lecture 9.pptxlecture 9.pptx
lecture 9.pptxITNet
 
lecture 10.pptx
lecture 10.pptxlecture 10.pptx
lecture 10.pptxITNet
 
lecture 11.pptx
lecture 11.pptxlecture 11.pptx
lecture 11.pptxITNet
 
lecture 12.pptx
lecture 12.pptxlecture 12.pptx
lecture 12.pptxITNet
 
lecture 13.pptx
lecture 13.pptxlecture 13.pptx
lecture 13.pptxITNet
 
lecture 15.pptx
lecture 15.pptxlecture 15.pptx
lecture 15.pptxITNet
 
kandegeeee.pdf
kandegeeee.pdfkandegeeee.pdf
kandegeeee.pdfITNet
 
Ia 124 1621324160 ia_124_lecture_02
Ia 124 1621324160 ia_124_lecture_02Ia 124 1621324160 ia_124_lecture_02
Ia 124 1621324160 ia_124_lecture_02ITNet
 
Ia 124 1621324143 ia_124_lecture_01
Ia 124 1621324143 ia_124_lecture_01Ia 124 1621324143 ia_124_lecture_01
Ia 124 1621324143 ia_124_lecture_01ITNet
 
Cp 121 lecture 01
Cp 121 lecture 01Cp 121 lecture 01
Cp 121 lecture 01ITNet
 
Cp 111 5 week
Cp 111 5 weekCp 111 5 week
Cp 111 5 weekITNet
 
Teofilo kisanji university mbeya (TEKU) ambassador 2020
Teofilo kisanji university mbeya (TEKU) ambassador 2020Teofilo kisanji university mbeya (TEKU) ambassador 2020
Teofilo kisanji university mbeya (TEKU) ambassador 2020ITNet
 
Tn 110 lecture 8
Tn 110 lecture 8Tn 110 lecture 8
Tn 110 lecture 8ITNet
 
Tn 110 lecture 2 logic
Tn 110 lecture 2 logicTn 110 lecture 2 logic
Tn 110 lecture 2 logicITNet
 
Tn 110 lecture 1 logic
Tn 110 lecture 1 logicTn 110 lecture 1 logic
Tn 110 lecture 1 logicITNet
 
internet
internetinternet
internetITNet
 
Im 111 lecture 1
Im 111   lecture 1Im 111   lecture 1
Im 111 lecture 1ITNet
 
development study perspective full
development study perspective fulldevelopment study perspective full
development study perspective fullITNet
 
Gender issues in developement
Gender issues in developementGender issues in developement
Gender issues in developementITNet
 

More from ITNet (20)

lecture 8 b main memory
lecture 8 b main memorylecture 8 b main memory
lecture 8 b main memory
 
lecture 9.pptx
lecture 9.pptxlecture 9.pptx
lecture 9.pptx
 
lecture 10.pptx
lecture 10.pptxlecture 10.pptx
lecture 10.pptx
 
lecture 11.pptx
lecture 11.pptxlecture 11.pptx
lecture 11.pptx
 
lecture 12.pptx
lecture 12.pptxlecture 12.pptx
lecture 12.pptx
 
lecture 13.pptx
lecture 13.pptxlecture 13.pptx
lecture 13.pptx
 
lecture 15.pptx
lecture 15.pptxlecture 15.pptx
lecture 15.pptx
 
kandegeeee.pdf
kandegeeee.pdfkandegeeee.pdf
kandegeeee.pdf
 
Ia 124 1621324160 ia_124_lecture_02
Ia 124 1621324160 ia_124_lecture_02Ia 124 1621324160 ia_124_lecture_02
Ia 124 1621324160 ia_124_lecture_02
 
Ia 124 1621324143 ia_124_lecture_01
Ia 124 1621324143 ia_124_lecture_01Ia 124 1621324143 ia_124_lecture_01
Ia 124 1621324143 ia_124_lecture_01
 
Cp 121 lecture 01
Cp 121 lecture 01Cp 121 lecture 01
Cp 121 lecture 01
 
Cp 111 5 week
Cp 111 5 weekCp 111 5 week
Cp 111 5 week
 
Teofilo kisanji university mbeya (TEKU) ambassador 2020
Teofilo kisanji university mbeya (TEKU) ambassador 2020Teofilo kisanji university mbeya (TEKU) ambassador 2020
Teofilo kisanji university mbeya (TEKU) ambassador 2020
 
Tn 110 lecture 8
Tn 110 lecture 8Tn 110 lecture 8
Tn 110 lecture 8
 
Tn 110 lecture 2 logic
Tn 110 lecture 2 logicTn 110 lecture 2 logic
Tn 110 lecture 2 logic
 
Tn 110 lecture 1 logic
Tn 110 lecture 1 logicTn 110 lecture 1 logic
Tn 110 lecture 1 logic
 
internet
internetinternet
internet
 
Im 111 lecture 1
Im 111   lecture 1Im 111   lecture 1
Im 111 lecture 1
 
development study perspective full
development study perspective fulldevelopment study perspective full
development study perspective full
 
Gender issues in developement
Gender issues in developementGender issues in developement
Gender issues in developement
 

Recently uploaded

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 

Recently uploaded (20)

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 

Computer programing 111 lecture 2

  • 1. PRINCIPLES OF PROGRAMMING CP 111 Lecture No. 2
  • 2. OUTLINE ● Problem solving techniques and strategies, ● Understanding problem solving steps such as ○ Problem analysis, ○ design, implement, and ○ code test. ● Simple Input/ Output statements ● Escape codes, ● Programming Errors: syntax, runtime, and logical. ● Describing syntax and semantics
  • 4. Problem solving techniques and strategies ● A computer cannot solve a problem on its own. ● One has to provide step by step solutions of the problem to the computer. ● In fact, the task of problem solving is not that of the computer. ● It is the programmer who has to write down the solution to the problem in terms of simple operations which the computer can understand and execute.
  • 5. Problem solving techniques and strategies…. ● Procedures (Steps Involved in Problem Solving) ● In order to solve a problem by the computer, one has to pass though certain stages or steps. 1. Understanding the problem 2. Analyzing the problem 3. Developing the solution (Design) 4. Coding and implementation.
  • 6. Problem solving techniques and strategies…. 1. Understanding the problem: ● Here we try to understand the problem to be solved in totally. ● Before with the next stage or step, we should be absolutely sure about the objectives of the given problem. 2. Analyzing the problem: ● After understanding thoroughly the problem to be solved, we look different ways of solving the problem and evaluate each of these methods. ● The idea here is to search an appropriate solution to the problem under consideration. ● The end result of this stage is a broad overview of the sequence of operations that are to be carried out to solve the given problem.
  • 7. Problem solving techniques and strategies…. 3. Developing the solution: ● Here the overview of the sequence of operations that was the result of analysis stage is expanded to form a detailed step by step solution to the problem under consideration. 4. Coding and implementation: ● The last stage of the problem solving is the conversion of the detailed sequence of operations in to a language that the computer can understand. ● Here each step is converted to its equivalent instruction or instructions in the computer language that has been chosen for the implantation.
  • 8. Problem solving techniques and strategies…. What is Algorithm? Definition ● A set of sequential steps usually written in Ordinary Language to solve a given problem. It may be possible to solve to problem in more than one ways, resulting in more than one algorithm. ● The choice of various algorithms depends on the factors like reliability, accuracy and easy to modify. ● The most important factor in the choice of algorithm is the time requirement to execute it
  • 9.
  • 10.
  • 11.
  • 12. Simple Input/ Output statements ● cin and cout are two predefined C++ objects which represent standard input and output stream. ● The standard output stream represents the screen, while the standard input stream represents the keyboard. ● These objects are members of iostream class. ● Hence the header file <iostream.h> should be included in the beginning of all C++ programs.
  • 13.
  • 14. Escape code Escape codes ● Escape codes are used to represent characters that are difficult to express otherwise in the source code. For instance a tab (t). ● Escape codes all start with a backslash (). ● Escape codes can also be used to express octal (base-8) or hexadecimal (base- 16) numbers. An octal number can be used like this: 10 (backslash followed by a number.) ● A hexadecimal number can be used like this: xF0 (a backslash followed by an x and the number.)
  • 16. Programming Errors Error is an illegal operation performed by the user which results in abnormal working of the program. ● Programming errors often remain undetected until the program is compiled or executed. ● Some of the errors inhibit the program from getting compiled or executed. ● Thus errors should be removed before compiling and executing.
  • 17. Programming Errors Types of program errors ● We distinguish between the following types of errors: 1. Syntax errors: errors due to the fact that the syntax of the language is not respected. 2. Semantic errors: errors due to an improper use of program statements. 3. Logical errors: errors due to the fact that the specification is not respected. From the point of view of when errors are detected, ● We distinguish: 1. Compile time errors: syntax errors and static semantic errors indicated by the compiler. 2. Runtime errors: dynamic semantic errors, and logical errors, that cannot be detected by the compiler (debugging).
  • 18.
  • 19. Syntax, semantics, and pragmatics ● Every programming language has syntax, semantics, and pragmatics. ● We have seen that natural languages also have syntax and semantics, but pragmatics is unique to programming languages.
  • 20. Syntax, semantics, and pragmatics ● A programming language’s syntax is concerned with the form of programs ○ how expressions, commands, declarations, and other constructs must be arranged to make a well-formed program. ● A programming language’s semantics is concerned with the meaning of programs: ○ how a well-formed program may be expected to behave when executed on a computer. ● A programming language’s pragmatics is concerned with the way in which the language is intended to be used in practice.
  • 21. Syntax, semantics, and pragmatics Pragmatics is the third general area of language description, referring to practical aspects of how constructs and features of a language may be used to achieve various objectives. ● Consider, for example, the syntax, semantics and pragmatics of an assignment statement. As a syntactic construct, an assignment statement may consist of a variable and an expression (themselves syntactic constructs), separated by the token = as an assignment operator. Semantically, the variable denotes a location in computer memory, while the expression denotes computation of a value based on the contents of memory. ● Overall, the semantics of assignment is to perform the expression evaluation based on current memory contents and then update the value stored in the particular location corresponding to the variable. But what is often most interesting to programmers is really the pragmatics, that is, what assignment statements are useful for. ● There are many possibilities: to set up a temporary variable for the value of an expression that is needed more than once, to communicate values from one part of a program to another, to modify part of a data structure, or to set successive values of a variable used in some iterative computation.
  • 25.
  • 26.
  • 27. An important note about compilers: ● Modern compilers typically are very accurate in identifying syntax errors and will help you enormously in correcting your code. ● However, compilers often present two difficult problems for new programmers: a) They frequently can miss reporting an actual error on one line but get “thrown off track,” then report errors on subsequent lines that are not truly errors; the compiler may then also display error messages which are incorrect; and b) After encountering one true syntax error, compilers often generate many incorrect syntax error messages; again, the compiler has been “thrown off track” by a particular error. Why does this occur? Basically, because a compiler is a very complex and sophisticated language-processing program, and no computer program can analyze any language as well as a human being can at this point in time.
  • 28.
  • 29.
  • 30. Errors detected by the compiler and runtime errors
  • 31. Errors detected by the compiler and runtime errors
  • 32. What is debugging ? Debugging: ● Is the process of identifying and removing errors from computer hardware or software. or ● is the process of detecting and removing of existing and potential errors (also called as 'bugs') in a software code that can cause it to behave unexpectedly or crash. ● To prevent incorrect operation of a software or system, debugging is used to find and resolve bugs or defects
  • 33. What is debugging ?.... ● Debugger: is a computer program that assists in the detection and correction of errors in other computer programs. ● A debugger is a computer program used by programmers to test and debug a target program. ● Debuggers may use instruction-set simulators, rather than running a program directly on the processor to achieve a higher level of control over its execution.
  • 34. Techniques for detecting errors (debugging) • If the testing phase signals the presence of logical errors, or if we are not able to detect the cause for a runtime error, it is necessary to debug the program. • There are two ways in which we can obtain information that is helpful for debugging a program: 1. By inserting output statements in the code; 2. By executing the program by means of a debugger.