Monday, April 19, 2010

Learning & Assessment Activity 1.7

View the code for each button and note of any differences you can see in the algorithm. We will discuss these differences as we continue.
 
Publish the differences in each algorithm to your assessment document.

Public Class Form1

    Private Sub btnEnds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnds.Click

        Dim intCount = 0
        Do While intCount <= 1
            MsgBox("This is a repeating message box with an end")
            intCount += 1
        Loop

    End Sub

    Private Sub btnNeverEnds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNeverEnds.Click

        Dim intCount = 0
        Do While intCount <= 1
            MsgBox("This is a repeating message box that never ends (you will need to click the stop button to end)")
        Loop

    End Sub
End Class

The difference between the two algorithms as you can see above is that with the button that says end,the message actually does end whereas with the button named never ends,the message never ends.Basically the later message is looping,it is constantly continuing.

No comments:

Post a Comment