我需要帮助将这种代码类型从循环转换为Do Loop While
循环。我正在使用 Visual Basic 2010 Express 作为运行这些代码的程序,如果有人能帮助我,我将不胜感激。下面是需要转换为 For...Next 循环类型的代码。再次感谢任何可以提供帮助的人。Do While Loop
For...Next
Private Sub btnDo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDo.Click
Dim intNum, intSum As IntegerDo
intSum += intNum ‘accumulator/running total
intNum += 2 ‘update intNum
Loop While (intNum <= 50)
Me.lblDoAnswer.Text = intSum.ToString
End Sub
Private Sub btnDoWhile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDoWhile.Click Dim intNum, intSum As Integer
Do While (intNum <= 50)
intSum += intNum ‘accumulator/running total
intNum += 2 ‘update intNum
Loop
Me.lblDoWhileAnswer.Text = intSum.ToString
End Sub