Finally when the trailer record is detected the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: chart in Figure 11.8 is a solution to this problem. There are two decision symbols in this flowchart. The first decision symbol checks for a trailer record by comparing Rollno against the value 9999999 to determine if processing is complete. The second decision symbol is used to check whether the student has passed or failed by comparing the percentage marks obtained by him/her against 30. If the student's Percentage is equal to or more than 30 then he/she has passed otherwise failed. Note from the flowchart that the operation "Write output data" is performed only if the student has passed. If the student has failed, we directly perform the operation "Read input data" without performing the "Write" operation. This ensures that the output list provided by the computer will contain the details of only those students who have passed in the examination. Start Count= 0 Read input data Is Rollno = 9999999? If yes Write count Stop If no Add marks of all subjects giving Total Percentage = Total/10 Is Percentage = > 30? Yes Write output data Add1 to count If No Read input data Another point to be noted in this flowchart is the use of the variable Count. This variable has been initialized to zero in the beginning and is incremented by 1 every time the operation "Write output data" is performed. But we have seen that the operation "Write output data" is performed only for the students who have passed. Hence, the variable Count will be incremented by 1 only in case of students who have passed. Thus, the value of Count will always be equal to the number of students whose data has already been processed and who have been identified as passed. Finally, when the trailer record is detected, the operation "Write Count" will print out the final value of Count that will be equal to the total number of students who have passed the examination. Example 11.6. Suppose the input data of each student for the examination of Example 11.3 also contains information regarding the sex of the candidate in the field named...
View Full Document

Ask a homework question - tutors are online