Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
redim shared as string Result(-1) 'represent our sets as strings;
|
||||
'this'll do to illustrate the concept
|
||||
|
||||
sub sym( A() as string, B() as string )
|
||||
dim as integer ai, bi, ri
|
||||
dim as boolean add_it
|
||||
for ai = lbound(A) to ubound(A)
|
||||
add_it = true
|
||||
for bi = lbound(B) to ubound(B)
|
||||
if A(ai) = B(bi) then
|
||||
add_it=false
|
||||
exit for 'if item is common to both lists, don't include it
|
||||
end if
|
||||
next bi
|
||||
if add_it then
|
||||
for ri = 0 to ubound(Result)
|
||||
if A(ai) = Result(ri) then
|
||||
add_it=false
|
||||
exit for
|
||||
'if item is already in the result, don't include it again
|
||||
end if
|
||||
next ri
|
||||
end if
|
||||
if add_it then
|
||||
redim preserve as string Result(0 to ubound(Result)+1)
|
||||
Result(ubound(Result)) = A(ai)
|
||||
end if
|
||||
|
||||
next ai
|
||||
end sub
|
||||
|
||||
dim as string A(0 to 3) = {"John", "Bob", "Mary", "Serena"}
|
||||
dim as string B(0 to 4) = {"Jim", "Mary", "John", "Bob", "Jim"}
|
||||
'contains a double to show code can handle it
|
||||
|
||||
|
||||
sym(A(), B())
|
||||
sym(B(), A())
|
||||
|
||||
for i as uinteger = 0 to ubound(Result)
|
||||
print Result(i)
|
||||
next i
|
||||
Loading…
Add table
Add a link
Reference in a new issue