You are on page 1of 6

LESSON 1 - INTRODUCTORY CONCEPT

In the detailed design you will produce a graphic representation of the

AN OVERVIEW

program logic that includes all processing activities.

At present, there are over 200 programming languages; these are the
ones that are still being used.

5. Code the program

Initially, programming languages were created by people in


universities or in government and were devised for special functions.

7. Document the program

PROGRAMS AND LANGUAGES


COMPUTER PROGRAM
It directs a computer to perform certain operation.
It is a series of instructions that enables the computer to perform
a task.
The instruction must be specific, detailed, logical, sequential, and
clearly phrased

It produced by a programmer, who uses any, a variety of


programming languages to communicate with the computer.
STEPS

IN

WRITING

P R O G R AM

1. Describe the problem

Identify exactly what needs to be done. It often helps to describe the


problem in words.
2. Analyze the problem.

It examines the output, input, processing, and file interaction


component.

In this step you break the problem into its basic components for
analysis.
3. Design the general logic or algorithm of the program.

The general design of the program is oriented primarily to the major


processing activities and relationships between these activities.
4. Design the detailed logic of the program.

Lecture in C++

6. Test and debug the program

PROGRAMMING LANGUAGE
It is a set of rules that provides a way of telling a computer what
operation to be performed.
In most programming language, a computer is instructed to
accept data, store the data, do basic arithmetic operations,
display or print data, and repeat instruction automatically.
LEVELS
1. Machine Language

It is the lowest level, represents data and program instruction as 1s


and 0s binary digits corresponding to the on and off electrical states in
the computer.
2. Assembly Language

It is considered very low level they are not convenient for people to
use as more recent language
3. High-Level Language

It is an English-like programming language that is easier to use than


older symbolic language
4. Very High-Level Language

It is essentially shorthand programming languages


5. Natural Language

It is a programming language that resembles human language.


Sometimes referred to as Knowledge-Based Language because
natural language are used to interact with a knowledge on some
object
Page 1 of 6

PROGRAM DESIGN

AND

TECHNIQUE

A number of techniques are available to help the programmers to


analyze a problem and design the program.
The most popular techniques are flowcharting and pseudocode.
These techniques also can be used as design tools for an
information system.

Flowchart does not highlight the important details since each step
receives as much attention in a flowchart as any other.

TYPES
1.

OF

F L O W C H AR T

System Flowchart
It sometimes called a Run Diagram or a Purpose Diagram.

PSEUDOCODE

It is valuable tool used in system analysis.

It is an intermediate form of writing program instructions;


instructions that approach the computer programming language
but are written in an English-like language instead of true
programming language so that programming logic can be checked
more easily.

It is a graphic presentation of the broad flow of work,


documents, and operations through the major components of a
computer system.

Example:
Add A and B and store the result to C
Divide N by 3 and assign the result to X

5.

F L O W C H A RTI N G
It is a diagram representing the logical sequence in which a
combination of steps or operation is to be performed.
It consists of labeled geometric shapes that are interconnected to
provide a pictorial representation of data processing procedure.
The predefined graphic symbols of a flowchart are used to indicate
the various operations and the flow of control.
L I M I T AT I O N :
1.

Flowcharts do not represent a programming language and are


more of a person-to-person than a person means of
communication.

A computer cannot accept a program describe in flowcharting form.


2.

Flowcharts cannot be viewed s a natural means of communication.

3.

Certain details often require a long sequence of interconnected


symbols which could be easily be described in just a few lines of
explanation.

4.

2.

Program Flowchart
It is one designed to portray the various arithmetic and logic
operations that must be accomplished to solve a data
processing problem.
It helps the programmer to visualize the job and aids him in
planning the sequence of instruction he must write for the
machine.

F L O W C H AR T I N G S Y M B O L S
The following set of symbols that can be used doe systems and
program flowcharts conform to the International Organization
for Standardization (ISO) and American National Standard
Institution (ANSI)
TERMINAL SYMBOL indicates the STARTing and
ENDing point of a flowchart.
It is also used to signal an interruption in the
program flow.
INITIALIZATION SYMBOL assigns the initial values
of the variables, usually 0 (zero) for numeric and
(null) for string
INPUT/OUTPUT SYMBOL represents an instruction

It does not convey why a given set of operation is made.

Lecture in C++

Page 2 of 6

to be processed.
It is used for input and print command.
PROCESSING
SYMBOL
executes
operation and calculations.

arithmetic

Comparison

()

Grouping

Logical OR

&

Logical AND

= or EQ

Equal to

It is used for one or more computational task to


perform sequentially.

> or GT

Greater than

< or LT

Less than

DECISION SYMBOL indicates the decision point in


a program flow and that the program is to select
one of several paths, depending on the specified
condition tested.

<> or NE

Not Equal to

>= or GE

Greater than or Equal to

<= or LE

Less than or Equal to

ON-PAGE CONNECTOR is a non-processing


symbol used to connect separated portion of a
flowchart without drawing flow lines between
parts.

FLOWLINES shows the sequence


instructions are executed.

in

It shows the path of logic flow in a program.

which

Yes
No

EOF

End of File

PROGRAM CONTROL STRUCTURES

It denotes an exit of the program path line from


one part of the flowchart or an entry to another
part of the flowchart of the same page.
OFF-PAGE CONNECTOR shows an exit of the
program path line from one part of the flowchart
or an entry to another part of the flowchart on a
different page.

Y
N

These are necessary to organize the flow of control in a program.

SEQUENCE STRUCTURE
It indicates that control flows from processing box to another.
It represents events that occur immediately one after another.
F L O W C H AR T :
Start

F L O W C H AR T I N G N O TATI O N S

Lecture in C++

NOTATION

MEANING

Addition

Subtraction

Multiplication

Division

* * or

Exponentiation

End
Page 3 of 6


PROBLEM:
Given the three numbers A, B, and C. Make an algorithm and
draw a flowchart to compute and print out the sum, average,
and product of these values.

SELECTION STRUCTURE
It is used to test a condition and provide for a choice of one
between two alternatives.
F L O W C H AR T :

Pseudocode:

Start

1.

Read the values of A, B, and C.

2.

Calculate the sum of A, B, and C, Sum = A + B + C.

3.

Compute the average, Ave = Sum / 3.

4.

Compute the product of A, B, and C, Pro = A * B * C.

5.

Print out the computed values, Sum, Ave, and Pro.

Flowchart:

Y
N

Cond
n

End
Start

PROBLEM:
Read
A, B, C

SUM = A + B + C

AVE = SUM / 3

PRO = A * B * C

PRINT SUM,
AVE, PRO

Due to poor results of an examination, your teacher decides to


increase each students grade by 5 points, input the grade and
print the new grade. If the original grade exceeds 90, then it
remains.
Pseudocode:
1.

Input the original grade as Grade.

2.

If Grade > 90, then NGrade = Grade

3.

If Grade <= 90, then NGrade = Grade + 5

4.

Print out the new grade, NGrade.

End

Flowchart:
Lecture in C++

Page 4 of 6

It is the amount added to a value or variable of the counter.


Start

Contrast with Decrementation.


Y
GRADE
<= 90

Input
GRADE

The counter reflects the number of times the operation has


NGRADE =
GRADE

been performed.

The process of incrementation/decrementation is always done within the


loop.

N
NGRADE = GRADE +
5

3. Test for Limit Condition


It is the process of testing is usually found either at the beginning or at
the end of a loop.

F
Print
NGRADE

Before the logic gets out of loop, a loop terminating condition must first
be satisfied.

F L O W C H AR T :
End

Start

LOOPING STRUCTURE

It occurs when an event is repeatedly performed as long as the


given condition is true or is false, as the case may be.
It provides a means of repeating part of a computation or
instruction without rewriting the part of a computation or
instruction.

Y
Condn

M E C H AN I S M :

1. Loop is the repetition of steps in a program


End

2. Loop Body contains the steps to be repeated.


3. Iteration is each repetition of the loop body.
STEPS:
1. Initialization

PROBLEM
Juan Kulit was punished for being talkative in his typing class.
He has to type I PROMISE TO BE MORE ATTENTIVE 500
times. Juan finished the task in 1 minute. How did he do it?

It is the value of the counter is initially set to 0 or 1.


This process is usually done outside the loop.
2. Incrementation
Lecture in C++

Pseudocode:
1.

Set a counter and initialize a value, CTR = 1.


Page 5 of 6

2.

Print out I PROMISE TO BE MORE ATTENTIVE

3.

Increment of the counter, CTR = CTR + 1.

4.

If CTR <=500, then return to step 2.

5.

If CTR > 500, then stop

Flowchart:
Start

CTR = 1

F
Print
I PROMISE TO BE
MORE ATTENTIVE

CTR = CTR + 1

CTR <=
500

N
End

Lecture in C++

Page 6 of 6

You might also like