0% found this document useful (0 votes)
144 views4 pages

Program Life Cycle: Steps To Follow in Writing or Creating A Program

The document provides an overview of computer programming concepts including: - Programs are sets of step-by-step instructions that direct computers. Programmers design programs to solve problems. - The program life cycle includes identifying problems, planning solutions, coding, testing, and documenting programs. - Programming languages have evolved from machine language to high-level languages like C++ that are easier for humans. - Key aspects of C++ programs are preprocessor directives, header files, variable declarations, data types, and the main program body.

Uploaded by

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

Program Life Cycle: Steps To Follow in Writing or Creating A Program

The document provides an overview of computer programming concepts including: - Programs are sets of step-by-step instructions that direct computers. Programmers design programs to solve problems. - The program life cycle includes identifying problems, planning solutions, coding, testing, and documenting programs. - Programming languages have evolved from machine language to high-level languages like C++ that are easier for humans. - Key aspects of C++ programs are preprocessor directives, header files, variable declarations, data types, and the main program body.

Uploaded by

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

Lecture in IT 121 – Computer Programming 1

Program
- Is a set of step-by-step instruction that tells or directs the computer what to do.
- It sequences the task a user wants done and produces the results or output needed.

Programmer
- Is the person who designs a program, decides which of the programs or set of
instructions to use and tests the program to see if it is working as designed.
- It converts problem solutions into instructions for the computer

Program Life Cycle: Steps to follow in writing or creating a program


1. IDENTIFY THE PROBLEM
 It involves determining the requirement of the program.
2. PLANNING THE SOLUTION
 Draw a Flowchart – is a graphical representation of the step-by-step instruction
to be done in a program.
 Write a Pseudo code – is listing down the set of instructions to be used in the
program.
3. CODING THE PROGRAM
 As you designed the solution the next step is to code the program with the use
of a chosen programming language.
4. TESTING THE PROGRAM
 After coding the program, it is important to test if it is running. Testing the
program involves three phases:
1. Desk Checking – in this phase the programmer just mentally traces or checks the
logic of the program to make sure that its error free.
2. Translation – in this phase the programming language uses a translator to ensure
that the programmer did not violate any language rules by chosen
programming language. It translates line by line to locate any syntax error
3. Debugging – this means detecting, locating and correcting bugs. In
programming, error or mistakes are called BUGS.
Two Types of Programming Error:
Clerical Error – occur in the coding or data entry process.
Logical Error – are often harder to detect, they occur because the programmer
does not thoroughly understand a phase of the problem to be solved.
5. DOCUMENTATION
 In this step, the programmer makes a detailed description on how the program
was created.
 It contains a brief narrative process undergone by the program, from the
identification of the problem, planning the solution through flowcharting and
pseudo code, coding of the program up to the testing results.
 Codes used for the program are also included in this documentation as
reference for the next programmer who will upgrade the designed program.

Page 1 of 4
Lecture in IT 121 – Computer Programming 1

Levels of Programming Language


1. Machine Language or 1st Generation Language
 Considered to be the lowest level of programming language. The program is
represented by 1s and 0s. 1s and 0s or Binary number is the only language the
computer understands.
2. Assembly Language or 2nd Generation Language
 Instead of using 1s and 0s, assembly language uses mnemonic codes. Mnemonic
Codes are abbreviations that are easy to remember. Each type of computer has its
own assembly language.
3. High Level Language or 3rd Generation Language
 This language transformed programming in the early 1960s. It makes programming
easier since the language is now written in English like manner. If ASSEMBLER is used by
assembly language, third generation languages use TRANSLATOR to convert the
program into a machine language.
4. Very High Level Language or 4th Generation Language
 Simplifies further the 3rd level generation languages because there is a reduction in the
number of instructional statements. One hundred (100) lines of instructions in 3GLs can
be reduced to five (5) to twenty (20) lines of instructions in 4GLs.
5. Natural Languages
 Considered to be the 5th Generation Languages. Natural Languages have the
capability to translate human instructions into code that a computer understands.

A Brief History of C and C++

The C Language
In the early 1970s, Dennis Ritchie of bell Laboratories was engaged in a project to develop a
new operating system. Ritchie discovered that in order to accomplish his task, he needed the use of
a programming language that was concise and that produced compact and speedy programs. This
need led Ritchie to develop the programming language called C.

The C++ Language


In the early 1900s,also at the Bell Laboratories, another programming language was created
which was based upon the C Language. This language was developed by Bjarne Stroustrup and was
called C++. C++ is an extension of C. Bjarne added features to C and formed what he called “C with
Classes”. When he designed C++, he added OOP (Object Oriented Programming) features to C
without significantly changing the C component.

How to open the C Environment in LCC Lab:


- Double Click the DOS BOX icon
- Type the following:
mount c: c:/ (press ENTER)
c: (press ENTER)
cd turboc/bin (press ENTER)
tc (press ENTER)

Page 2 of 4
Lecture in IT 121 – Computer Programming 1

Preprocessor Directive – this part contains the Turbo C standard library to be used for proper
operation of the program. Example: #include<stdio.h>
Header File – contains definitions of functions and variables which can be incorporated into
any C program by using the pre-processor #include statement. Standard header files are
provided with each compiler, and cover a range of areas, string handling, mathematical,
data conversion, printing and reading of variables.

Common File names and their related Functions:


conio.h – Direct console I/O functions graphics.h – Graphics-related functions
math.h – Mathematical functions stdio.h – standard I/O functions
iostream.h – Input/output stream function

Declaration Area – this portion of the program is where the variables are being declared.
Variables – are the names that refer to sections of memory into which data can be stored.
Kinds of Variables: a. Global Variable – these are variables that can be used throughout the
program. b. Local Variable – these are variables declared inside a function. It can be
referenced only by a statement that are inside the block in which the variable is declared.
Rules in naming VARIABLES:
- A variable should start at all times with an alphabetic character (a-z | A-Z) or an underscore only.
- The preceding characters can be alphanumeric (concatenation of letters and numbers) or an
underscore only.
- No space is allowed in between the variable.
- A variable should be short, meaningful and descriptive.
- DON‟T use any of the C Reserved Keywords.

Data Types – every variable must have a data type. A variable‟s data type determines the values
that the variable can contain and the operations that can be performed on it.
TYPE DESCRIPTION EXAMPLE RANGE
Is a whole number consisting of an optional sign 12, -128,
int (Integer) -32,768 to 32,768
(+ or -)followed by a sequence of digits 0, 14
Is a number which can be written as a finite
2.555
float (floating decimal, it consist of optional sign (+ or -),
-83.789 3.4E-38 to 3.4E+38
Point) followed by one or more digits, a decimal point
1.75
and one or more further digits.
Is a special float which can store more significant 9.23E+3 stands for
double
digits and have a larger exponent, it takes up 9.23 times 103
(double 1.7E-308 to 1.7E+308
more space in memory. This is express in scientific 9.23 * 1000 equals
precision) 9230.0
notation (a number times a power of 10)
Is a single or a series of letter, digit, punctuation
mark or control symbol recognized by the „a‟
char „Hello‟
computer depending on how such variable is „Hi!‟ 0 to 255
(character)
declared. It is written enclosed within single „Roses are Red‟
quotation marks
void Associated with no data type

Body of the program – the main program has always the keyword main followed with { (open curly
brace) to denote the beginning of the program, and ends with } (close curly brace).

Comment /*…*/ – these refers to the added explanation located anywhere in the program which
serves only as the reminder to the programmer or to make the code readable to the other user.

Page 3 of 4
Lecture in IT 121 – Computer Programming 1

Note: Turbo C is case sensitive (use lower case for safe coding). Every statement in Turbo C is terminated by ; (semi colon).
Variables could also be declared inside the main function.

Keywords / Reserved words – These are words which has a special meaning / function in Turbo C and
should not be used to name any variable or constants. Keywords may vary from one programming
language to another.

NEW File OPEN File

SAVE File EXIT / QUIT

Compile – ALT + F9
Run - A LT + R + R or ALT + R + Enter

Page 4 of 4

You might also like