Академический Документы
Профессиональный Документы
Культура Документы
1
PROGRAMMING LANGUAGES
2
THE LANGUAGE TRANSLATION PROCESS
How are Programs Understood by the Computer?
Processed
By CPU
3
PROGRAMMING LANGUAGES
Machine Language
(first generation of programming languages)
The computers native language
Composed of binary digits (0s, 1s)
The only language that computers understand
Assembly Language
(second generation of programming languages)
One-to-one correspondence to machine language
Somewhat more user-friendly than machine language (mnemonic
rather than binary digits)
Assembler program that translates an assembly language
program into machine language
4
PROGRAMMING LANGUAGES
Procedural Languages (High Level Languages)
(third generation languages)
One instruction translates into many machine language
instructions
Programs describe the computers processing step-by-step
Closer to natural language; uses common words rather than
abbreviated mnemonics
Examples: C, Fortran, QuickBasic
Compiler - translates the entire program into machine language
Interpreter - translates and executes one source program
statement at a time
5
PROGRAMMING LANGUAGES
Nonprocedural Language
(fourth generation languages)
Allows the user to specify the desired result without having to
specify the detailed procedures needed for achieving the result
Example: data base query language - SQL
Can be used by non technical users
6
PROGRAMMING LANGUAGES
7
CURRENT PROGRAMMING LANGUAGES
Visual Programming Languages
Used within a graphical environment
Example: Visual Basic and Visual C++
Popular to non technical users
Componentware
Software components that may be assembled by developer as needed
Plug and Play software development
8
CURRENT PROGRAMMING LANGUAGES
Extensible Markup Language (XML)
Improved on web document functionality
9
PROCESSING A HIGH LEVEL LANGUAGE
PROGRAM
Steps to execute a program written in C++:
1. Use an editor to create a program. (source program)
2. Compiler translate the program in to an equivalent
machine language. (object program)
3. The programs that you write in a high-level language are
developed using a software development kit (SDK), which
contains many programs that are useful in creating your
program. This prewritten code resides in a place called
the library.
4. Linking programs: The linker assembles all of functions
(source and systems) into final executable program.
5. The next step is to load the executable program into
the main memory for execution and a program called
loader accomplishes this.
6. The final step is to execute the program.
10
STEP IN PROGRAM DEVELOPMENT
Programming can be defined as the development of a solution to an identified
problem, and the setting up of a related series of instructions that will produce the
desired results.
11
STEP IN PROGRAM DEVELOPMENT
Develop the Outline into an Algorithm
The solution outline developed in Step 2 is expanded into an algorithm: a set of precise steps that
describe exactly the tasks to be performed and the order in which they are to be carried out.
12
PROGRAMMING WITH THE PROBLEM
ANALYSIS CODING EXECUTION
CYCLE
Problem solving process
First step
Define the problem.
Outline the solution.
Design an algorithm.
Test the algorithm for correctness.
Second step
Implement the algorithm in programming
language, such as C++.
Run the program on the computer
Last step
Document and maintain the program.
WHAT IS AN ALGORITHM?
A step-by-step problem solving procedure, especially an establish,
recursive computational procedure for solving a problem in a finite
number of steps.
An algorithm has to
be clear
have a finite length
stop in finite time
Pseudocode
Structure Diagram and finally in C++
Flowcharts
14
WRITE A PROGRAM CALCULATING THE SUM OF
TWO NUMBERS : ADDITION
Input Processing Output
5, 10 15
16
PSEUDO CODE
18
WRITING PSEUDO CODE
Pseudocode
READ name, hoursWorked,
payRate
gross = hoursWorked * payRate
WRITE name, hoursWorked,
gross
19
PSEUDOCODE WRITE A PROGRAM
CALCULATING THE SUM OF TWO NUMBERS
Pseudocode are English-like statements that
follow a loosely defined syntax and are used to
convey the design of an algorithm.
Version 1: Version 2:
PROGRAM Add Two Numbers
PROGRAM Add Two Numbers
READ First
READ two numbers
READ Second
ADD the numbers
Sum = First + Second
WRITE the sum
WRITE Sum
END PROGRAM
END PROGRAM
20
STRUCTURE CHART
23
MODULAR DESIGN WRITE A PROGRAM CALCULATING THE SUM OF
TWO NUMBERS
Unstructured
Structured Programming
Programming
A program is broken down Style of programming in
into small independent tasks which small and simple
that are small enough to be programs consist of only
understood easily without one main program.
having to understand the
whole program at once.
C++ CODING WRITE A PROGRAM
CALCULATING THE SUM OF TWO NUMBERS
/* Addition of 2 numbers */
return 0;
}
26
FLOW CHART AND ALGORITHM- ACTIVITY
27