示例#1
0
        public static void MainTest(string[] args)
        {
            int[]           a   = { 33, 22, 11, 31, 35, 27, 24, 25 };
            StaticSETofInts set = new StaticSETofInts(a);

            Console.WriteLine("Set contains:");
            OrderHelper.Show(a);
            Console.WriteLine("Set contains {0}: {1}", 11, set.Contains(11));
            Console.WriteLine("Rank of {0}: {1} with same rank: {2}", 35, set.Rank(35), (a.Length - 1) == set.Rank(35));
        }
示例#2
0
        public static void MainTest(string[] args)
        {
            TextInput input = new TextInput(args[0]);

            int[] white = input.ReadAllInts();
            input.Close();

            // remove duplicates, if any, so the ctor below will not throw an exception
            white = OrderHelper.RemoveDuplicates(white);
            StaticSETofInts set = new StaticSETofInts(white);

            TextInput StdIn = new TextInput();

            // Read key, print if not in whitelist.
            while (!StdIn.IsEmpty)
            {
                int key = StdIn.ReadInt();
                if (!set.Contains(key))
                {
                    Console.WriteLine(key);
                }
            }
        }