Educational Blog Sites

Wednesday, July 26, 2017

Degree Computer Programming

Unit 2 : Programming Tools

Introduction
This unit will help learner about the programming tools like flowcharts, pseudocodes, use of which improves the efficiency of programming and programming skill. Flowcharts give a pictorial representation of the logic. This is described with several symbols and rules associated with them. Some examples on flowchart are also included for making the idea clear. Pseudocode is another method which is very similar to programming languages. The method of writing programmes with the help of pseudocode has been given in the lessons. Decision tables are another representation of programmes. Decision table describes how conditional statements are represented in short cut format in a table. The last lesson of this unit describes some methods of representing data structures of input and output of the programme. Warnier-Orr diagrams are such diagrams. Structured chart gives a pictorial representation of programme by dividing main module into different modules and by parameter passing between the modules.

Lesson 3: Flow Charts-I
3.1 Learning Objectives 
On completion of this lesson you will learn
i) the basic concepts of flowcharts
ii)  some examples and their representation by flowcharts
iii) symbols used to represent different actions.
3.2 FlowChart for Describing Algorithms
An algorithm is a set of instructions which when followed will produce the solution to a given problem. Algorithms occur in noncomputing contexts as well as in programming. You can think of the recipe for baking a cake as an algorithm- certainly a recipe is a set of instructions which, when followed, will result in a cake. Likewise, the instructions in a stereo kit are steps which, when followed, will produce a properly assembled electronic device. If the instructions are poorly written or if they are not followed precisely, the result is a soggy cake. Consider the following instructions that you need to make a cup of tea.
1. Pour water in a kettle.
2. Turn the oven on.
3. Place the kettle on the oven.
4. Turn the oven off.
Do you see what is wrong? The instructions never mentioned the time when the oven must be turned off. Of course, a human being would probably compensate for the inadequate instructions by making some assumptions or by his common-sense (which are not common to even sophisticated machines like computers). A machine, however, would not and this “program” would not work properly. The step 4 can be executed only after being confirmed that the water in the kettle is already boiled. So, a condition must be tested satisfactorily before the step 4 can be executed. So the correct algorithm will be:
Note that in this diagram we have enclosed each instruction in a box and drawn an arrow to the instruction that follows. This type of diagram, called a flowchart, is very useful as a means of visualising the relationships among the statements of algorithms.
Share:

0 comments:

Post a Comment

Translate

Total Pageviews

Search This Blog

Blog Archive

Recent Posts