Program Life Cycle: Steps To Follow in Writing or Creating A Program
Program Life Cycle: Steps To Follow in Writing or Creating A Program
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
Page 1 of 4
Lecture in IT 121 – Computer Programming 1
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.
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.
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.
Compile – ALT + F9
Run - A LT + R + R or ALT + R + Enter
Page 4 of 4