我正在尝试提出这个问题的代码:
要求用户输入十个数字,然后显示最大的一个
到目前为止我已经想出了这个,但是看看它是如何实现的,我只能看到错误:
Sub Main()
Dim One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten As String
Console.WriteLine("Please enter your first number")
One = Console.ReadLine
Console.WriteLine("Please enter your second number")
Two = Console.ReadLine
Console.WriteLine("Please enter your third number")
Three = Console.ReadLine
Console.WriteLine("Please enter your fourth number")
Four = Console.ReadLine
Console.WriteLine("Please enter your fifth number")
Five = Console.ReadLine
Console.WriteLine("Please enter your sixth number")
Six = Console.ReadLine
Console.WriteLine("Please enter your seventh number")
Seven = Console.ReadLine
Console.WriteLine("Please enter your eighth number")
Eight = Console.ReadLine
Console.WriteLine("Please enter your nineth number")
Nine = Console.ReadLine
Console.WriteLine("Please enter your tenth number")
Ten = Console.ReadLine
If Ten > Nine Then
Console.WriteLine("Your biggest number is" & Ten)
Else
If Nine > Eight Then
Console.WriteLine("Your biggest number is" & Nine)
Else
我需要看看最大的数字是多少。另一个学生正在使用数组来实现这一点,但我似乎还无法解决它们。
那么在用户输入数字后,我该如何实现呢?
我尝试(上面)使用 If 语句,但我看到代码很广泛,如果一个人在开头输入一个较大的数字,然后在最后输入一个,则会出现错误,因为它只会显示第一个较大的数字......