top of page

L.C.P        Logic of Programs construction

The "Elementary" structures of programs :

The Alternative structure :

An alternative structure of data set, is a set in which one or more Sub-Sets are encountered whose presence is random. If there are several, the presence of one is exclusive of that of the others.

There are two kinds of alternatives in the input data sets :

   - The alternative relative to the physical presence of the Sub-set used,
   - The alternative relating to the value of a data

Here are the schemas (F.L.E and Program) corresponding to two alternative structures :

Due to the presence or not of a subset of data :

A little lexicon French ---> English !

Début = Beginning or start

Fin = End

                                           Thank you....

Due to the value of a data :

A small remark, finally two! ...

- You notice that the rhombus (symbol of a conditional branch), is attached to the sequence "Beginning of structure", in fact this comparison and corresponding branching instruction,  is an integral part of the sequence and therefore the last instruction of it , it's not outside!

- The rectangles represent a logical sequence of the program. A logical sequence contains all the instructions to be executed the same number of times in the same place of the program. (Spread the word !)

We have already seen the so-called "repetitive" structure, we have just seen the so-called "alternative" structure, these are the two elementary structures that we will use to build any program as complex as it is. We will see in the pages that follow that the so-called "complex" structures are in fact only imbrications of these two elementary structures.

Before moving to "complex" structures, I would like to show you the case of an Sub-set of data used 0 or N times ! Which if you remember, breaks down into two Sub-sets, a first present (0-1) and the second (n times). Here is a small example, after, we will not come back to it OK ?

In our previous example, "list of customer orders" we assume that a customer may not have yet ordered !, in this case the presence of the Sub-set "commands" is present (0 - N times), here is the schematic solution :

A little lexicon French ---> English !

Client = Customer

Cdes = Orders

                                       Thank you....

Ancre 1

Exercise :

Make yourself the hierarchical subdivision of the program.

If you can not find it ---> Solution 1

You have noticed that each Sub-set of the program includes a sequence "Start" and a sequence "End" executed once.

Let us now attack the so-called "complex" structures ---->

bottom of page