Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class
- TEST
- create
- make
- feature
- make
- -- Initialising TEST
- local
- a, b: SET_INT
- i : INTEGER
- r : RANDOM
- do
- create a.empty_set
- create b.empty_set
- create r.make
- from
- i := 0
- until
- i = 100
- loop
- a.add ((r.double_item * 100).floor)
- r.forth
- b.add ((r.double_item * 100).floor)
- r.forth
- i := i + 1
- end
- print("a: " + a.out)
- IO.put_new_line
- print("b: " + b.out)
- IO.put_new_line
- print("Union: " + a.union (b).out)
- IO.put_new_line
- print("Intersection: " + a.intersection (b).out)
- IO.put_new_line
- print("a - b: " + (a - b).out)
- IO.put_new_line
- print("b - a: " + (b - a).out)
- IO.put_new_line
- print("Cardinality of a: " + a.card.out)
- IO.put_new_line
- print("Cardinality of b: " + b.card.out)
- IO.put_new_line
- print("Is a a subset of b? " + a.is_subset (b).out)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement