0% found this document useful (0 votes)
12 views

Lecture 12 Programming

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lecture 12 Programming

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Course tittle :

The computing application


An Introduction to Programming
Programming a Computer

It is important to understand the relationship between


the terms programs, programmers, and programming
languages.
Programs - The directions that humans give to
computers
Programmers - The people who create these directions
Programming Languages - Special languages used by
programmers to communicate directions to a
computer

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 3
whole or in part.
Programming

Programming is how you get computers to solve


problems.

 The process of designing and building an executable


program to a specific computing result
Set to rule that can used to write a program
PROGRAMMING LANGUAGE

A language that can be used to write the program


The computer program written in programming
language
A person who develop the program is called
programmer
Two types of language for computer
 High-level-language
That provides little or no abstraction of
programming concepts
Low-level-language is near to computer
and far from human

 Low-level-language
High-level-language is near to human and
far from computer
Instruction are similar to English language
such as input, print
Set of rule are define writing a program
The Programmer’s Job

• Programmers help solve computer


problems
• Employee or freelance
• Typical steps involved
– Meet with user to determine problem
– Convert the problem into a program
– Test the program
– Provide user manual

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 7
whole or in part.
What Traits Should a Software Developer
Possess?
• Analytical skills
• Communication skills
• Creativity
• Customer-service
skills
• Detail oriented
• Problem-solving skills
• Teamwork
• Technical skills

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 8
whole or in part.
Employment Opportunities

• Computer software engineer: designs an


appropriate solution to a user’s problem
• Computer programmer: codes a computer solution
• Coding is the process of translating a computer
solution into a language a computer can understand
• Some positions call for both engineering
and programming

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 9
whole or in part.
A Brief History of Programming Languages

There are many different types of


programming languages. This chapter will
discuss:

• Machine languages
• Assembly languages
• High-level procedure-oriented languages
• High-level object-oriented languages

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 10
whole or in part.
Machine Languages

• The first programmers had to write the


program instructions using only combinations
of 0s and 1s
– Example: 0000 0101 1100 0000
• Instructions written in 0s and 1s are called
machine language or machine code
• Each type of machine has its own language
• Machine languages are the only way to
communicate directly with the computer
• Programming in machine language: tedious and
error- prone; requires highly trained programmers
© 2016 Cengage Learning®. May not be scanned, copied or
An Introduction to Programming with C++, Eighth Edition 11
duplicated, or posted to a publicly accessible website, in
whole or in part.
Assembly Languages

• Assembly languages made writing code simpler


than using only 0s and 1s
• Mnemonics – symbols used to represent the
actual machine language instructions
Example: 00000101 vs. BALR
• Assembly programs require an assembler to
convert instructions into machine code
• Easier to write programs in assembly language
– But still tedious and requires highly trained
programmers
© 2016 Cengage Learning®. May not be scanned, copied or
An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 12
whole or in part.
High-Level Languages

• High-level languages allow programmers to use


English- like instructions
Example: taxAmount = total * taxRate
• Each high-level language instruction is equivalent
to more than one machine language instruction
• Compilers translate high-level instructions into 0s
and 1s (machine language)
• Interpreters translate the program line by line as
the program is running

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 13
whole or in part.
High-Level Languages (cont.)
• When writing a procedure-oriented program, the
programmer concentrates on the major tasks that
the program needs to perform
– Examples: COBOL, BASIC, C
• An object-oriented program requires the
programmer to focus on the objects that the
program can use to accomplish its goal
– Examples: C++, Visual Basic, Java, C#
• Object-oriented programs allow for an object to be
created that can be reused in more than one
program
© 2016 Cengage Learning®. May not be scanned, copied or
An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 14
whole or in part.
Control Structures

All computer programs are written using one or more of


three basic control structures: sequence, repetition, and
selection. Another term used for control structures are
logic structures, because they control the logic flow of
the program.

While in every program that is written the


sequence structure will be used, in most all
programs all three control structures will be used.

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 15
whole or in part.
The Sequence Structure

• The sequence structure directs the computer to


process the program instructions, one after another,
in the order in which they are listed in the program
• An algorithm is a finite number of step-by-
step instructions that accomplish a task
• Example: steps to pump gas at a self-service
pump

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 16
whole or in part.
The Sequence Structure (cont.)

Figure 1-1 An example of the sequence structure

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 17
whole or in part.
The Selection Structure

• The selection structure directs the computer to make


a decision (evaluate a condition), and then take an
appropriate action based upon that decision
• The selection structure allows the programmer to
evaluate data, therefore properly controlling the
logic flow of the program
• Another name for the selection structure is the
decision structure
• Example: stopping or going at a signal light

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 18
whole or in part.
The Selection Structure (cont.)

Figure 1-2 An example of the selection structure

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 19
whole or in part.
The Selection Structure (cont.)

Figure 1-3 Another example of the selection structure

An Introduction to Programming with C++, Eighth Edition 17


The Repetition Structure

• The repetition structure, commonly called iteration


or looping, directs the computer to repeat one or
more program instructions until some condition is
met
• This condition may be checked at the beginning or
end of the set of instructions to be processed
dependent upon the language being used
• The repetition structure allows the programmer
to repeatedly process a set of instructions, while
only typing them in once

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 21
whole or in part.
The Repetition Structure (cont.)

Original algorithm and modified algorithm


showing the repetition structure

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 22
whole or in part.
Summary

• Programs are step-by-step instructions that tell


a computer how to perform a task
• Programmers use programming languages
to communicate with the computer
• First programming languages were machine
language using 0s and 1s
• Assembly languages followed, using mnemonics
• High-level languages can be used to created
procedure- oriented or object-oriented programs

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 23
whole or in part.
Summary (cont.)

• An algorithm is a finite number of step-by-


step instructions that accomplish a task
• Algorithms utilize three basic control
structures: sequence, selection, and repetition
• The sequence structure directs the computer to
process the program instructions, one after another,
in the order in which they are listed
• The selection structure directs the computer to make
a decision (evaluate a condition), and then take an
appropriate action based upon that decision

© 2016 Cengage Learning®. May not be scanned, copied or


An Introduction to Programming with C++, Eighth Edition duplicated, or posted to a publicly accessible website, in 24
whole or in part.

You might also like