Sie sind auf Seite 1von 6

APRIL 23, 2014

WORD CHAPTER 9 - LAB TEST


MS WORD C
CONNIE POLING
SCR

Table of Contents
STRUCTURED PROGRAMMING ..............................................................................................................................1
Sequence Structure ....................................................................................................................................................1
Selection Structure .....................................................................................................................................................1
Iteration Structure ......................................................................................................................................................2
TOP-DOWN DESIGN/TOP-DOWN PROGRAMMING .............................................................................................2
Top-Down vs. Structured...........................................................................................................................................3
Index ..........................................................................................................................................................................4

STRUCTURED PROGRAMMING

Well-written computer programs are developed according to the rules of structured


programming. Structured programming is a methodology by which all program logic can be
developed by using and combining just three basic logic control structures sequence,
selection, and iteration. A logic control structure is a way in which statements in a program can
be executed. The use of structured programming offers advantages to both the programmer
and the programmer's employer. These advantages are summarized below.

Programs are neater in appearance and more readable.


The reliability and efficiency of programs are improved.
Less time is spent debugging, testing, and modifying programs.
Programmer productivity is increased.

The logic structures used in structured programs are described in the following sections.
Sequence Structure
In a sequence structure, one imperative statement is executed after another. An imperative
statement indicates that some action in the program is to occur. The computer is instructed to
complete an action such as READ a record or DISPLAY a record, then complete another action,
and then another, and so on.
Selection Structure
A selection structure executes code based on the result of a condition. A condition, such as
COUNT > 1 (COUNT is greater than 1), can be true or false depending upon the value of the
variable COUNT. A selection structure allows for one of two sets of actions to be executed
depending on whether a condition is true or false. A case structure, which is an extension of the
selection structure, allows for one of several different actions to be executed based on the
value of a variable.

Iteration Structure
Iteration, or looping, is another structure fundamental to all computer-programming
languages. It allows a set of instructions to be executed over and over until some
predetermined condition is met. There are two basic iteration structures and the only real
difference between the two is the point at which testing a condition takes place. In the first
iteration structure, referred to as the Do-while structure, testing is performed first. Hence,
depending on the results of the test, the computer may never execute any of the code within
the loop. If the condition is met, the loop can be terminated before it ever begins.
In the second iteration structure, often referred to as the Do-until structure, testing the
condition occurs after the logic in the loop is executed the first time. In a Do-until structure, you
are assured the computer will execute the statements within the loop at least once.
TOP-DOWN DESIGN/TOP-DOWN PROGRAMMING

Top-down design and top-down programming are methodologies used to solve large problems.
Top-down design is a strategy that breaks large, complex problems into smaller, less complex
problems. Each one of the less complex problems then is broken down into even smaller
problems. Top-down design can be thought of as a divide and conquer strategy. In top-down
programming, high-level modules are coded as soon as they are designed, generally before the
low-level modules have been designed. In the top-down approach, both the design and
programming are accomplished by beginning with the general and moving to the more specific.
For almost all the programs written today, the logic is broken down into small,
manageable modules, or subroutines. Each subroutine solves a specific part of the overall
problem. From a maintenance standpoint, a modular program is easier to understand and
modify. Each subroutine should be relatively smallusually no more than one page of source
codeand should handle just one function of the program. Hence, you should be able to

evaluate a program quickly and determine where modifications need to be inserted. Something
called a hierarchy chart illustrates the top-down organization typical of a computer program.
Top-Down vs. Structured
Do not confuse structured programming with top-down programming. They are not the
same. Structured programming is a method of coding the logic within the subroutines of a
program. Top-down programming is a method of organizing the program into manageable
subroutines.

Index
condition ........................................................................................................................................................................1
Do-until structure ..........................................................................................................................................................2
Do-while structure .........................................................................................................................................................2
imperative statement ....................................................................................................................................................1
logic control structure ...................................................................................................................................................1
methodology .................................................................................................................................................................1
Top-down design ...........................................................................................................................................................2

Das könnte Ihnen auch gefallen