Exemplo n.º 1
0
        static void RunProgram(ref bool programRunning)
        {
            int arrLen = InputHandling.ReadCollectionLength();

            int[] arr   = new int[arrLen];
            int   index = 0;

            InputHandling.ReadCollectionElements(ref arr, arrLen, ref index);
            int[] freqArray = FrequencyOfElements.GenerateFrequencyArray(arr, arrLen);
            int   maxIndex  = MaxMinArray.MaxIndex(freqArray, freqArray.Length);

            OutputHandling.Message("The element with the most occurences inside the array is " + maxIndex, ConsoleColor.Magenta);
            OutputHandling.Question("Do you want to find another value in an array with the most numbers of occurences? Y / N");
            programRunning = InputHandling.QuestionOptions();
        }
Exemplo n.º 2
0
        static void RunProgram(ref bool programRunning)
        {
            OutputHandling.Question("First String: ", false);
            string firstString = Console.ReadLine();

            int[] firstStringFreqArray = FrequencyOfElements.GenerateFrequencyArray(firstString, firstString.Length);

            OutputHandling.Question("Second String: ", false);
            string secondString = Console.ReadLine();

            int[] secondStringFreqArray = FrequencyOfElements.GenerateFrequencyArray(secondString, secondString.Length);

            bool isAnagram = Anagram.FindAnagram(firstStringFreqArray, secondStringFreqArray);

            Anagram.PrintAnagramResult(isAnagram, firstString, secondString);

            OutputHandling.Question("Do you want to check other two strings for anagram?");
            programRunning = InputHandling.QuestionOptions();
        }