Educational Blog Sites

Wednesday, July 26, 2017

Online Degree in Computer Programming

Lesson 4 : FlowCharts-II

4.1 Learning Objectives
On completion of this lesson you will learn
i)  advanced features of flowcharts like program loops and decisions
ii)  how modularity of flowchart can be achieved.

4.2 Looping in Flowchart
Computers are efficient in executing repetitive operations. In programs, there are invariably repetitive operations, which are needed to be represented in flowcharts. Consider the following flowchart where the start block shows where the algorithm begins.
In figure 4.1 an unconditional infinite loop is shown. The exception in this flowchart is the flow direction from lower to upper. The last block of this flowchart will never be executed.
Figures 4.2 and figure 4.3 represent flowcharts containing conditional looping. Looping occurs according to the output of condition checking.
In figure 4.2 condition checking is done at the end and in figure 4.3 condition checking is done in the beginning.

4.3 Examples of Looping
Suppose you wish to visit the botanical garden, and therefore, are looking for one of your friends to accompany you. So you take out your book of few phones and select a likely prospect. Dial the number, make few talk, and finally invite the friend to visit. If he (or she) accepts the offer, you have finished your work. If you are refused, then go back and select another number. These actions are shown in a flow chart in Figure 4.4. The essential concept in this algorithm is the branch back to an

earlier statement to create a loop. A loop is a sequence of instructions which is repeated several times. Note that each time the programme goes through the loop a different telephone number is used; the instructions remain unchanged but the data operated on differs. If you eventually get an acceptance, you would reach the end block. However, if you keep on getting rejections, then you re-execute the loop instructions. Since you only have a finite number of telephone numbers in your book, you must stop when the data run out. Converting this flowchart to a series of instructions in English is straight forward:
0. Start.
1. Take out phone book.
2. Select prospect.
3. Dial number.
4. Make few talk.
5. If prospect does not accept, go to step 2.
6. end.
A similar algorithm could be constructed to find the right blood donor in a medical emergency. The program might be used if there were an urgent need for a donor with type B-positive blood. If the medical records of the students at a college were kept on a machine readable device, the computer could be used to search for the collection of data (called the file). Input and output are represented by specially shaped blocks :
The algorithm reads the name and blood type of a student. If the blood type is B-positive, then the name is printed; otherwise it loops back to read the next record. This process continues until all the records have been read. A programmer might begin by mapping the steps visually, using flowchart like in Fig. 4.5.
 The algorithm could be written out :
0. Start.
1. Read NAME, blood TYPE.
2. If TYPE not equal to B-positive, go to step 1.
3. Print NAME.
4. Go to step 1
5. End.

Share:

4 comments:

  1. High Technologies Solutions is one of the Government Certified Center in Delhi Who Provide Autocad Training Course in Delhi. 100% Positive Reviews, Certified Trainer, Lab Facility. For More Information- https://www.htsindia.com/
    For More-
    Autocad institute in delhi

    ReplyDelete
  2. Looking for the best institute in Delhi, Noida and Gurgaon for Cad Courses. So High Technologies Solutions is an ISO Certified Center for Cad Course. Certified Trainer, 100% Placements, real time Project.
    For More
    Cad Course training Center in Delhi

    ReplyDelete

Translate

Total Pageviews

Search This Blog

Blog Archive

Recent Posts