【发布时间】:2014-10-07 15:54:15
【问题描述】:
我一直在用 VB 制作咩咩黑羊,但一直卡在程序的最后一点。我试图让程序说明用户是否为拥有这些包的人输入了正确的信息,但它似乎没有注册最后一部分。非常感谢任何帮助!
Module Module1
Sub Main()
Dim WoolAnswer As String = ""
Dim BagNumber As Integer = 0
Dim FirstBag As String = ""
Dim SecondBag As String = ""
Dim ThirdBag As String = ""
Console.WriteLine("Do you have any wool?")
WoolAnswer = Console.ReadLine
If WoolAnswer = "yes" Then
Console.WriteLine("How many bags do you have?")
BagNumber = Console.ReadLine
If BagNumber = 3 Then
Console.WriteLine("Who is the first bag for?")
FirstBag = Console.ReadLine()
Console.WriteLine("Who is the second bag for?")
SecondBag = Console.ReadLine
Console.WriteLine("Who is the third bag for?")
ThirdBag = Console.ReadLine
Else
Console.WriteLine("That is not the correct amount of bags.")
End If
Else
Console.WriteLine("You have no wool.")
End If
**If (FirstBag = "master" & SecondBag = "dame" & ThirdBag = "little girl") Then
Console.WriteLine("You really know your nursery rhymes!")
End If**
**This is the part that doesn't work**
Console.ReadLine()
End Sub
End Module
【问题讨论】:
-
你会得到我在 SO 上见过的最奇怪的问题标题的分数。
-
这不是写 IF 语句的方法;尝试
If (FirstBag = "master" AndAlso SecondBag = "dame" AndAlso ThirdBag = "little girl") Then& 符号用于字符串连接 -
玫瑰是红色,紫罗兰是蓝色,& 用于连接;也给你。
标签: vb.net visual-studio-2010 visual-studio-2012