Copyright 2001 (c) Logic Code Generator Ltd; You must not take information from this web page and reuse without the owner's permission!

LogicCoder Tutorial 5 of 7: CREATE FLOWCHART

How to draw Flowcharts and write Programs

This section of the tutorial introduces the basic operation of drawing a program flowchart with LogicCoder. You can use LogicCoder to quickly draw flowcharts by clicking symbols into position. You can also use LogicCoder layout editing features to align symbols relative to each other and to clip connecting line symbols to enhance the layout looks of your flowcharts.

Apart from easy program flowchart design, LogicCoder allows you to generate code using the control logic in your flowchart. This tutorial shows you how to draw the flowchart design for a relative simple program problem and then use the flowchart to generate a source program in BASIC and in ANSI C++.

At the end of going through these tutorials you should
Use LogicCoder GUI system to draw the flowchart for a relatively simple Input/Output program problem solution.
State the Advantages and Disadvantages of using Flowcharts to represent the Control Logic of a Computer Program

In this web page I show you the the following features of LogicCoder:

The graphical user interface (GUI) that LogicCoder provides for easy program flowchart design.

How to use this flowchart to describe, document a program and to automatically generate a source program from it.

I also highlight some key features of the system that makes it easy for you to visually manipulate and understand the control logic of large and complex programmed systems.

I show you how to use LogicCoder to minimize a complex system to create an easy to manage abstract view.

You get a free tutorial version of LogicCoder for ANSI C/C++ and BASIC programming whenever you make on-line purchase of any of the following books.

  • Structured Programming with BASIC I; ISBN 0-9544270-1-7; Price $44.00 USD
  • Structured Programming with ANSI C; ISBN 0-9544270-0-9; Price $56.00 USD
  • Object Oriented Programming with ANSI C++; ISBN 0-9544270-3-3; Price $66.50 USD

In this example program problem I show you how to Design, Document a problem solution and how to map language command statements to algorithmic descriptive statements using a flowchart. I then show you how to generate the C source code from the logic design.

Click the following link to download the tutorial in pdf format. Click to download Please note however, that some section of this tutorial is missing. In addition, you must observe all copyright regulation in using the tutorial document. To begin, I start with a program problem specification as follows.

A program is to be designed and then coded in ANSI C/C++ that creates an output listing of telephone information on individuals. Input to the program consists of records of data values. A sample of these records to be used as test data is listed in the table below.


INPUT TEST DATA VALUES
Name Telephone Number Area Code

SAM HORN
SUE NUNN
BOB PELE
ANN SITZ
END OF FILE

749-2138
663-1271
999-1193
979-4418
999-9999
714
213
212
312
999

The input data file is to be listed as part of the program code for the purpose of testing the program. In this case, an array of record structure is declared in the program and the value in each record is used to initialize the elements of the array. The structure of each record is defined with the use of the C struct statement as illustrated here.

LogicCoder has functions that allows you to insert code sections into a source code file to be generated from a flowchart. You select the point in the program logic where you want the code to be inserted and you specify the code value you want inserted. You can also define variables and structures to be inserted in a source code to be generated.

The output when the program runs is a formatted listing of the data values in the input record. An illustration of the output is given as follows.

 
OUTPUT FROM THE PROGRAM
 
  Sample program test output  

The following is an illustration of the control logic which when coded implement the solution to the program problem. Actually, the solution is derived from an original solution designed for implementation in BASIC. LogicCoder has functions available that allows you to use this control logic to generate a source program in BASIC without having to do much changes to the flowchart layout.
 
The program control logic design

The logic to be used to implement the programming problem solution is illustrated by the flowchart in figure 1. Notice that a loop is appropriately used to process the array of records that constitute the input data file. The flowchart is an algorithmic description of the step-by-step process that is to be accomplished in order to implement the solution to the program problem.

Note that 2 Input/output symbols are drawn at the start of the program flowchart. They are used to print the first two lines on the output report. Each line is followed by a blink. Each is easily done in ANSI C/C++ with use of the printf( ) function. In fact, both lines could be easily printed by a single printf( ) function by use of an appropriate formatting string.

 

The program control logic
   
Figure 1
The control logic to be used by the source program that implement the given specification. A loop base on a counter variable is used to process the records in the input data file.


Later on I show you how to abstract this control logic to a simpler representation in order to develop a simpler but accurate view of the system. Advance versions of LogicCoder has functions that allows you to abstract or expand the complex details in a large and complex flowchart.

I now show you how to use LogicCoder to do the following:
Draw the required flowchart
Autoadjust interconnecting lines in the flowchart
Place descriptive and program command statement text in flowchart symbols
Select place and fragment compound symbols in a flowchart
Create an ANSI C/C++ source program from a flowchart
Lock symbols positions in a flowchart so that they do not move
Liaise with the mouse to select a group of symbols in a flowchart
Set fill colour for selected symbols in a flowchart
Symbol Highlighting and substructure abstraction

USING LOGICCODER TO DRAW THE PROGRAM FLOWCHART


STEP 1:
Select the Terminal symbol on the symbol template bar and then click the point in the user document interface where you want a copy of it to appear. The figure below gives further illustrative explanation

 

 

. Drawing the terminal symbol

On start up, LogicCoder sets a default fill colour when drawing flowchart symbols. You can change the default fill colour to a value of your choice or you can select individual symbols in an existing flowchart and then set their fill colour to that of your choice. I show you how this is done at a later point in the tutorial.

STEP 2:
Select the VLine symbol and then click below the middle of the Terminal symbol so that a VLine appear as illustrated in figure 3.

 

 

 

Drawing the first VLine symbol

Whenever you click in the user document window with a selected flowchart symbol from the flowchart template toolbar, either of the following 2 things happens.
(1) A copy of the selected flowchart symbol appears in the user document window at the point where you click.
(2) If a flowchart symbol is already at the point where you click, it is selected in the user document.

STEP 3:
Select and place a copy of each flowchart symbol so that your document window appears similar to that illustrated in figure 4. Do not worry if interconnecting lines are not neatly place. I will show you how to use the Autoadjust functions to fix their interconnection.

 

 

 

 

Drawing other symbols in the flowchart

I now show you how to insert and then fragment a compound symbol when drawing a flowchart. The last two symbols on the flowchart template bar are example compound symbols that you can use to quickly draw loops and case structures when implementing decision making control logic. More advance versions of LogicCoder uses other compound symbols to represent other complex substructures such as start and end terminal symbols or a closing connector.

STEP 4:
Select the Loop Decision symbol on the template menu bar and then click below the last VLine symbol in the flowchart so that a Loop Decision appear as illustrated in figure 5.


Notice that a selected symbol appears with a yellow rectangle around it. In the next step, you will use the Fragment Structure function to break the compound symbol into it's constituent.

 

 


Quickly draw a loop decission


You should always break compound symbols into their components before an attempt to use the flowchart to generate a source program. In addition, you should ensure that only the symbol you intend to fragment is selected before you attempt to execute this function.

In the next step you will complete the flowchart so that it implement the control logic illustrated in figure 1. You will then add descriptive and source code text to each symbol in the flowchart. The description is that illustrated in figure 1. The descriptive text is the same as the Algorithmic text.

When you start or open a flowchart document, LogicCoder by default sets the text view to Algorithmic. The Algorithmic text view of a flowchart allows you to see description of each instruction in the algorithm illustrated by the flowchart. In the section of this tutorial headed: SAVING THE SOURCE CODE TEXT FILE, I show you how to switch the text view of a flowchart. The "Source Code" view of a flowchart presents actual program command statement(s) in each symbol of the flowchart. These are source language commands that are to be executed in the required program. Each program command statement matches a description in a symbol.


In the next step, you will complete the flowchart so that it looks similar to that in figure 1

Fragment a compund symbol


You can also save the whole source code text view or load a whole source code text view for a given flowchart from backing storage. The source code text view you load can be for a single language or it can be for different programming languages. Therefore, you can use a single flowchart to write programs in different languages or you can use the same flowchart to write various forms of a program in the same source language.


STEP 6:
Select each required symbol on the flowchart template bar and then click them in position as illustrated in figures 7 and figure 8.

 

 

 

 

 

 

 

 

 

 

 

Completing the control logic of the flowchart
   

STEP 7:
(1) Select the Edit menu item on the main menu bar and then select the Flowchart item in the pull-down sub-menu
that appears.

At this point, your document window should appear similar to that in figure 9

 

 

(1) Use the mouse left button to click the Autoadjust All Line menu item so that the function execute.

At the end of executing this function, your flowchart should look similar to that illustrated in figure 10.

 

 

 

 

Selecting the Autoadjust Line Function.

You can also execute the Autoadjust All Lines functions in a flowchart by clicking on the shortcut button on the Flowchart Edit shortcut toolbar. To do this, you click the button labeled Aa.

More advance versions of LogicCoder also provides other autoadjust functions that allow you to align groups of symbols vertical or horizontal along common axes. There are also functions that allow you to align connectors with case decisions in a complex flowchart.

 

 

 

 

 

 

 

 

Autoadjust all lines in a flowchart

CONGRATULATION!! You have completed the flowchart layout for the program problem logic solution and is now ready to enterdescriptive and language command text into the flowchart symbols.

Copy right May 2002
Logic Code Generator Ltd
142a Shenley Road
Borehamwood
Hertfordshire WD6
Tel: +44(0)203 538 6133
EMail: info@

You must not take information from this web page and reuse without the owner's permission!

 

 

 

Home | Contact us | Online Service | Links

 

 

free hit counters