Structured Programming
Structured programming is a programming approach that emphasizes writing clear, organized, and logical code by dividing a program into smaller, manageable sections or functions. It uses three main control structures—sequence, selection, and iteration—to control the flow of the program instead of using unstructured jumps like goto statements. This method promotes top-down design, making programs easier to read, debug, test, and maintain. It is commonly used in languages such as C, Pascal, and Python, and forms the foundation of modern programming practices.
1. INTRODUCTION TO STRUCTURED PROGRAMMING
Basic Programming Concept
Program and Programming
A computer program is a series of organized instructions that directs a computer to perform
tasks. Without programs, computers are useless.
A program is like a recipe. It contains a list of variables (called ingredients) and a list of
statements (called directions) that tell the computer what to do with the variables.
Programming is a creation of a set of commands or instructions which directs a computer in
carrying out a task.
A programming language is a set of words, symbols and codes that enables humans to
communicate with computers.
Examples of programming languages are:
BASIC (Beginner‘s All Purpose Symbolic Instruction Code)
Pascal
C
Smalltalk.
Structured programming and other programming languages
Structured programming (sometimes known as modular programming) is a subset of
procedural programming that enforces a logical structure on the program being written to
make it more efficient and easier to understand and modify. Certain languages such as Ada,
Pascal, and dBASE are designed with features that encourage or enforce a logical program
structure.
Structured programming frequently employs a top-down design model, in which developers map out
the overall program structure into separate subsections.Program flow follows a simple hierarchical
model that employs looping constructs such as "for," "repeat," and "while." Use of the "Go To"
statement is discouraged.
C is called a structured programming language because to solve a large problem, C
programming language divides the problem into smaller modules called functions or
procedures each of which handles a particular responsibility. The program which solves the
entire problem is a collection of such functions. One major drawback of C language is that
similar functions cannot be grouped inside a module or class. Also functions cannot be
associated to a type or structure. Thus data and functions cannot be bound together. C++
Page 4 of 172
language overcomes these problems by introducing object oriented functionality in its
programming capabilities.