Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
47
Task/Hash-join/PureBasic/hash-join.basic
Normal file
47
Task/Hash-join/PureBasic/hash-join.basic
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