Professional Documents
Culture Documents
Programming is like writing. If you can write a demonstration, you can make
a program.
But, you actually, programming is not so easy, because a real good program
is not easily programmed. It needs the programmers’ lots of wisdom, lots of
knowledge about programming and lots of experience.
It is like writing, to be a good writer needs lots of experience and lots of
knowledge about the world. Learning and practice are necessary
Programming Techniques
Main Program
Data
Main Program
Data
no no
yes
stop
Each module can have its own data. This allows each module to
manage an internal state which is modified by calls to procedures or
functions of this module
Each module has its own special functionalities that supports the
implementation of the whole programming
Data
Module 1 Module 2
Data + Data2
Data + Data1
Function12 Function13
………
Dr. Falah Younis Algorithm Design _ Cihan University/ Sulaimaniya 13
-Top-down approach start with highest level functions-top-level and break
down into lower level program modules
Module: is a collection of instructions to accomplish some logical function or
task (modular programming) e.g. procedures / functions in a programming
language
Control program
Call module 1
Call module 2
Call module 3
The system
function11 function12
Thinking Methodology
• Induction (Abstract)
– From specialization to generalization
• From different dogs to create the word “dog”
Dog
17
Dr. Falah Younis Algorithm Design _ Cihan University/ Sulaimaniya
Thinking Methodology
• Induction (Abstract)
– From specialization to generalization
• From different dogs to create the word “dog”
Dog
18
Dr. Falah Younis Algorithm Design _ Cihan University/ Sulaimaniya
Object-Orientation
• A law system
• A cultural system
• An educational system
• An economic system
• An Information system
• A computer system
type identifier ;
Ex. float number;
Variable initialization:
type identifier = initial value;
Exs. int a= 40;
string name= “SAM”;
int: string:
a: 40 Name: SAM
Dr. Falah Younis Algorithm Design _ Cihan University/ Sulaimaniya 29
Identifier:
Is a sequence of one or more letters, digits or underscore characters ( _ ).
Neither spaces or symbols can be part of an identifier. Valid identifiers have to begin with a
letter. They can also begin with an underline character ( _ ), but in some cases these may be
reserved for compiler specific keywords or external identifiers.
Identifier should not match with standard reserved keywords for C++:
C++ Keywords
asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete,do,
double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline,
int, long, mutable, namespace, new, operator, private, protected, public, register,
reinterpret_cast, return, short, signed, sizeof, static, static cast, struct, switch, template, this,
throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile,
wchar_t, while
Comments:
The comments is only used to allow the programmer to insert notes or descriptions embedded
within the source code. They simply do nothing because they discarded by the compiler.
// line comments
/* block comments */