private static void Test(string[] args) { int[] whitelist = In.ReadInts(args[0]); Array.Sort(whitelist); while (!StdIn.IsEmpty) { int key = StdIn.ReadInt(); if (Rank(key, whitelist) == -1) { StdOut.Println(key); } } }
/// <summary> /// Reads in a sequence of real numbers from standard input and prints /// out their average to standard output. /// </summary> /// <param name="args">the command-line arguments</param> private static void Test(string[] args) { int count = 0; // number input values double sum = 0.0; // sum of input values // read data and compute statistics while (!StdIn.IsEmpty) { double value = StdIn.ReadDouble(); sum += value; count++; } // compute the average double average = sum / count; // print results StdOut.Println("Average is " + average); }