[英]Console.Write and Console.WriteLine in Visual Basic does not appear in console output
Tried to make a simple condition in Visual Basic but Console.write
and Console.WriteLine
does not appear in the Console Window, already set the output to Console Application试图在 Visual Basic 中创建一个简单的条件,但
Console.write
和Console.WriteLine
没有出现在控制台窗口中,已经将输出设置为控制台应用程序
Sub Main()
Console.Clear()
Console.WriteLine("**Kalkulator Hitung Nilai Menggunakan Console Aplication**")
Dim Tugas As Integer
Dim UTS As Integer
Dim UAS As Integer
Dim T As Double
Dim txtHuruf As Char
Console.Write("Masukan Nilai Tugas = ")
Tugas = Console.ReadLine()
Console.Write("Masukan Nilai UTS = ")
UTS = Console.ReadLine()
Console.Write("Masukan Nilai UAS = ")
UAS = Console.ReadLine()
T = (Tugas * 0.2) + (UTS * 0.5) + (UAS * 0.3)
If T > 85 Then
Console.Write("A")
ElseIf T > 70 Then
Console.Write("B")
ElseIf T > 50 Then
Console.Write("C")
ElseIf T > 30 Then
Console.Write("D")
ElseIf T > 0 Then
Console.Write("E")
End If
End Sub
The console does output the Input
but does not output every Console.WriteLine
控制台确实输出
Input
但不会输出每个Console.WriteLine
The program closed after this:该程序在此之后关闭:
and does not show the remaining output, using Visual Studio 2012.
并且不显示剩余的输出,使用 Visual Studio 2012。
You need to put Console.ReadXxx() as the last line in your program.您需要将 Console.ReadXxx() 作为程序的最后一行。
If T > 85 Then
Console.Write("A")
ElseIf T > 70 Then
Console.Write("B")
ElseIf T > 50 Then
Console.Write("C")
ElseIf T > 30 Then
Console.Write("D")
ElseIf T > 0 Then
Console.Write("E")
End If
Console.ReadKey() ' Or Console.ReadLine() / Console.Read()
Console.ReadKey() waits for any key. Console.ReadKey() 等待任何键。
Console.Read() and Console.ReadLine() waits for 'Enter' key. Console.Read() 和 Console.ReadLine() 等待 'Enter' 键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.