with Int_Set; use Int_Set; with Text_IO; use Text_IO; procedure Test_Set is package Int_IO is new Integer_IO(Integer); use Int_IO; Command : String(1..80); Command_Length : Integer; Value : Integer; Set : Integer_Set; begin Set := Empty_Integer_Set; loop Put("Command ([q]uery/[i]nsert/[r]emove/e[x]it): "); Get_Line(Command, Command_Length); if Command_Length < Command'First then null; -- user typed nothing; do nothing elsif Command(1) = 'q' then Put("Value (query/insert/remove): "); Get(Value); Skip_Line; if Has_Integer(Set, Value) then Put_Line(Integer'Image(Value) & " is present."); else Put_Line(Integer'Image(Value) & " is absent."); end if; elsif Command(1) = 'i' then Put("Value (query/insert/remove): "); Get(Value); Skip_Line; Add_Integer(Set, Value); elsif Command(1) = 'r' then Put("Value (query/insert/remove): "); Get(Value); Skip_Line; Remove_Integer(Set, Value); elsif Command(1) = 'e' or Command(1) = 'x' then exit; else Put_Line("Unrecognized command " & Command(1..Command_Length) & "."); end if; end loop; end Test_Set;