我爲我的一個類做了這個循環,但由於某種原因循環不停止。 這裏是我的代碼有我不能得到這個循環停止
Dim strScore As String
Dim intNumTests As Integer 'counter
Dim sngSumTests As Single 'accumulator
Dim sngAverage As Single
strScore = InputBox("Enter the score. Click cancel when finished.", "Score Entry")
Do While strScore <> " "
intNumTests = intNumTests + 1 ' update Counter
sngSumTests = sngSumTests + Val(strScore)
strScore = InputBox("Enter the score. Click cancel when finished.", "Score Entry")
Loop
Visual Studio是一個IDE,而不是語言。作爲IDE,它沒有循環。請[編輯]標籤以指定您的代碼使用的實際語言(以便它對未來的讀者有用,並使其獲得觀看該標籤的人的注意力)。另外,您可以嘗試使用調試器來幫助找出造成問題的原因。在代碼的第一行設置一個斷點並逐步遍歷它一次或兩次。 –