(1)New WindowsApplication;
(2)Form1上拖拽Lable1、Lable2。
Public Class Form1
Dim data As New ArrayList
Public Enum color
red
yellow
green
blue
white
End Enum
Public Enum country
England
Sweden
Denmark
Norway
German
End Enum
Public Enum drink
tea
coffee
milk
water
beer
End Enum
Public Enum smoke
Pall_Mall
Dunhill
Blends
Blue_Master
Prince
End Enum
Public Enum position
A
B
C
D
E
End Enum
Public Enum pet
dog
bird
cat
horse
fish
End Enum
Public Structure person
Dim col As color
Dim cou As country
Dim dri As drink
Dim smo As smoke
Dim pos As position
Dim pe As pet
End Structure
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Label1.Text = "1、在一条街上,有5座房子,喷了5种颜色。" & vbCrLf & _
"2、每个房里住着不同国籍的人。" & vbCrLf & _
"3、每个人喝不同的饮料,抽不同品牌的香烟,养不同的宠物。问题是:谁养鱼?" & vbCrLf & vbCrLf & _
"1、英国人住红色房子" & vbCrLf & _
"2、瑞典人养狗" & vbCrLf & _
"3、丹麦人喝茶" & vbCrLf & _
"4、绿色房子在白色房子左面" & vbCrLf & _
"5、绿色房子主人喝咖啡" & vbCrLf & _
"6、抽Pall Mall 香烟的人养鸟" & vbCrLf & _
"7、黄色房子主人抽Dunhill香烟" & vbCrLf & _
"8、住在中间房子的人喝牛奶" & vbCrLf & _
"9、挪威人住第一间房" & vbCrLf & _
"10、抽Blends香烟的人住在养猫的人隔壁" & vbCrLf & _
"11、养马的人住抽Dunhill香烟的人隔壁" & vbCrLf & _
"12、抽Blue Master的人喝啤酒 " & vbCrLf & _
"13、德国人抽Prince香烟" & vbCrLf & _
"14、挪威人住蓝色房子隔壁" & vbCrLf & _
"15、抽Blends香烟的人有一个喝水的邻居"
Dim per(4) As person
Dim tt As Integer() = {0, 1, 2, 3, 4}
pai(tt, 0, 5)
For intColor As Integer = 0 To data.Count - 1
For i As Integer = 0 To 4
per(i).col = CType(CType(data(intColor), Integer())(i), color)
Next
For intCountry As Integer = 0 To data.