Exemplo n.º 1
0
        static void Main(string[] args)
        {
            long   iBing          = 0;
            long   iGoogle        = 0;
            string KEY            = "AIzaSyDZ9Xp_pjTaqR7-9KwUaRrZtPJPloRXZ6E";
            string EngineIdGoogle = "004432549449583349288:nalrskjiw5l";
            string EngineIdBing   = "004432549449583349288:dzujar3pgzy";
            var    searchGoogle   = new Google();
            var    searchBing     = new Bing();

            Console.WriteLine("__________________________________________________");
            foreach (string argumento in args)
            {
                long resultsGoogle = searchGoogle.GetResults(argumento, KEY, EngineIdGoogle);
                long resultsBing   = searchBing.GetResults(argumento, KEY, EngineIdBing);
                if (resultsGoogle > resultsBing)
                {
                    iGoogle++;
                }
                else if (resultsGoogle < resultsBing)
                {
                    iBing++;
                }
            }
            Console.WriteLine("============================");
            if (iBing > iGoogle)
            {
                Console.WriteLine("Bing winner");
            }
            else if (iBing < iGoogle)
            {
                Console.WriteLine("Google winner");
            }
            else
            {
                Console.WriteLine("It is a tie");
            }
            Console.WriteLine("============================");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //string[] input;

            List <string> words = new List <string>();

            if (args.Length == 0)
            {
                Console.WriteLine("words to search");
                Console.WriteLine("Press key 'X' and ENTER to end");
                string word = "";
                int    cont = 1;
                do
                {
                    if (word != "")
                    {
                        words.Add(word);
                        cont++;
                    }
                    Console.Write("word " + cont + "(X:end): ");
                    word = Console.ReadLine();
                } while (word != "X" && word != "x");

                args = words.ToArray();
            }
            long   iBing        = 0;
            long   iGoogle      = 0;
            string KEY          = "AIzaSyAJuxgY1dQGQV45L1nIOoxLjJd7Cy-xA1M";
            string EngineIdG    = "010556043604774410724:xvljiggke1i";
            string EngineIdB    = "010556043604774410724:fzoekgp3pmq";
            var    searchGoogle = new Google();
            var    searchBing   = new Bing();

            Console.WriteLine("__________________________________________________");
            foreach (string argumento in args)
            {
                long resultsGoogle = searchGoogle.GetResults(argumento, KEY, EngineIdG);
                long resultsBing   = searchBing.GetResults(argumento, KEY, EngineIdB);
                if (resultsGoogle > resultsBing)
                {
                    iGoogle++;
                }
                else if (resultsGoogle < resultsBing)
                {
                    iBing++;
                }
            }
            Console.WriteLine("============================");
            if (args.Length > 0)
            {
                if (iBing > iGoogle)
                {
                    Console.WriteLine("Bing winner");
                }
                else if (iBing < iGoogle)
                {
                    Console.WriteLine("Google winner");
                }
                else
                {
                    Console.WriteLine("Both got a draw");
                }
            }
            else
            {
                Console.WriteLine("Nothing To do");
            }

            Console.WriteLine("============================");
        }