Cambridge IGCSE & O Level Computer Science Programming Book for Microsoft Visual Basic Sample

Page 42

We are working with Cambridge Assessment International Education towards endorsement of this title. Any references or material related to answers, grades, papers or examinations are based on the opinion of the author(s). CAMBRIDGE IGCSE™ & O LEVEL COMPUTER SCIENCE: PROGRAMMING BOOK

DEMO TASK 2.3 Use a flowchart to represent a system that checks the entry of a new password. The user must enter the password twice. If the two entries match the system will accept the new password and output a message to the user. If the two entries do not match the system will reject the password and repeatedly prompt for it to be re-entered until the two password inputs match.

LE

Solution START

INPUT Password1 INPUT Password2

FALSE

Password1 = Password2

P

OUTPUT "Passwords do not match, please re-enter"

M

TRUE

Accept New Password

A

OUTPUT "New Password accepted"

STOP

S

Flowchart 2.3: Flowchart to check the entry of a new password

NOTE: Observe the return flow from the FALSE path of the decision symbol. A flow that returns to an earlier stage in the flowchart represents iteration. In this example, the return loop indicates the continual repetition of the steps: •

input password twice

check passwords match

if no match prompt for re-entry of passwords.

30 Original material © Cambridge University Press 2021. This material is not final and is subject to further changes prior to publication.


Turn static files into dynamic content formats.

Create a flipbook
Cambridge IGCSE & O Level Computer Science Programming Book for Microsoft Visual Basic Sample by Cambridge International Education - Issuu