September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
47
Task/Hash-join/PureBasic/hash-join.purebasic
Normal file
47
Task/Hash-join/PureBasic/hash-join.purebasic
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
Structure tabA
|
||||
age.i
|
||||
name.s
|
||||
EndStructure
|
||||
|
||||
Structure tabB
|
||||
char_name.s
|
||||
nemesis.s
|
||||
EndStructure
|
||||
|
||||
NewList listA.tabA()
|
||||
NewList listB.tabB()
|
||||
|
||||
Macro SetListA(c_age, c_name)
|
||||
AddElement(listA()) : listA()\age = c_age : listA()\name = c_name
|
||||
EndMacro
|
||||
|
||||
Macro SetListB(c_char, c_nem)
|
||||
AddElement(listB()) : listB()\char_name = c_char : listB()\nemesis = c_nem
|
||||
EndMacro
|
||||
|
||||
SetListA(27, "Jonah") : SetListA(18, "Alan") : SetListA(28, "Glory")
|
||||
SetListA(18, "Popeye") : SetListA(28, "Alan")
|
||||
|
||||
SetListB("Jonah", "Whales") : SetListB("Jonah", "Spiders")
|
||||
SetListB("Alan", "Ghosts") : SetListB("Alan", "Zombies")
|
||||
SetListB("Glory", "Buffy")
|
||||
|
||||
If OpenConsole("Hash_join")
|
||||
ForEach listA()
|
||||
PrintN("Input A = "+Str(listA()\age)+~"\t"+listA()\name)
|
||||
Next
|
||||
PrintN("")
|
||||
ForEach listB()
|
||||
PrintN("Input B = "+listB()\char_name+~"\t"+listB()\nemesis)
|
||||
Next
|
||||
PrintN(~"\nOutput\nA.Age\tA.Name\tB.Char.\tB.Nemesis")
|
||||
ForEach listA()
|
||||
ForEach listB()
|
||||
If listA()\name = listB()\char_name
|
||||
PrintN(Str(listA()\age)+~"\t"+listA()\name+~"\t"+
|
||||
listB()\char_name+~"\t"+listB()\nemesis)
|
||||
EndIf
|
||||
Next
|
||||
Next
|
||||
Input()
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue