Imports System
Public Class Test
Public Shared Sub Main()
Dim n As Integer
n = Console.ReadLine
Do While n <> 42
System.Console.WriteLine(n)
n = Console.ReadLine
Loop
End Sub
End Class
我得到此代碼的運行時錯誤。我該如何改變它。以及如何限制循環打印數字從1到42而不是列表中的5?在vb.net運行時錯誤,想避免列表中的數字
你能提供你正在得到的錯誤嗎? – 2011-04-21 19:44:41
我想你會在'n = Console.ReadLine'上得到編譯錯誤,因爲'ReadLine'返回字符串' – Andrey 2011-04-21 19:45:46
嘗試'n = CInt(Console.ReadLine)' – 2011-04-21 19:46:54