Pages

Monday, April 16, 2012

Call Statement








ICT subject  (3765/1)

Method to write a program using the Call statement

Exercise 1

Private Sub CmdAdd_Click()
Dim num1 As Single, num2 As Single
Rem Display the sum of two numbers
PicResult.Cls
PicResult.Print " this program displays a sentence "
PicResult.Print " identifying two numbers and thier sum."
num1 = 2
num2 = 3
PicResult.Print " the sum of"; num1; "and"; num2; "is"; num1 + num2
End Sub

..................................................................................................................

Exercise 2

Private Sub ExplainPurpose()
Rem the task performed by the program
PicResult.Print " this program displays a sentence "
PicResult.Print " identifying two numbers and thier sum."
End Sub

Private Sub CmdAdd_Click()
Dim num1 As Single, num2 As Single
Rem Display the sum of two numbers
PicResult.Cls
Call ExplainPurpose
PicResult.Print
num1 = 2
num2 = 3
PicResult.Print " the sum of"; num1; "and"; num2; "is"; num1 + num2
End Sub

No comments:

Post a Comment