Chapter One_Problem Solving Computer
Chapter One_Problem Solving Computer
computers
CHAPTER 1
1.1. What is a program?
2
Machine Language
All computers have a native programming language
that they understand, commonly referred to
as machine code or language.
Any computer can directly understand only its own
machine language.
Machine language is the “natural language” of a
computer
Machine languages generally consist of strings of
binary code.
1.2. Programming Language
7
languages.
Translator programs called assembler were
High-level languages
High level language look more like natural
Algorithm design,
Coding,
Implementation, and
Maintenance.
I. Analysis
13
write it.
The Pseudo-code can easily be translated into the
programming language
Examples of pseudo code
16
Step 5: End
II. Algorithm …
17
2. Flowchart
Flowchart is a graphical or symbolic
representation of an algorithm.
It is the diagrammatic representation of the
int main ( )
{
int x, y, z;
cout<<“Enter two number : “;
cin>>x;
cin>> y;
z = x + y;
cout<<”The sum of two numbers is = “<<z;
return 0;
}
IV. Implementation
22
(syntax errors)
Up to complex:- flaws in the algorithm (logic errors).
V. Maintenance
23
the .cpp.
2.4. Compilation …
27
Phase 4: Linking
C++ programs typically contain references to
functions and data defined elsewhere, such as
in the standard libraries.
The object code produced by the C++ compiler
typically contains “hollow place" due to these
missing parts.
A linker links the object code with the code for
the missing functions to produce an executable
image (with no missing pieces).
If the program compiles and links correctly, an
executable image is produced.
2.4. Compilation …
29
Phase 5: Loading
Before a program can be executed, it must
first be placed in memory.
This is done by the loader, which takes the
Phase 6: Execution
Finally,
the computer, under the control of
its CPU, executes the program one
instruction at a time.
IDE …
31