Exemplo n.º 1
0
        static void Main(string[] args)
        {
            List <double> numberList = new List <double> {
                1, 2, 8, 2, 5, 3, 6, 3, 1, 7
            };

            Console.WriteLine(ListPractice.SumList(numberList));
            List <string> words = new List <string> {
                "a", "at", "cab", "poop", "seven", "eight", "bedtime", "cabrides", "goladders", "10letters"
            };
            string input;

            Console.WriteLine("Enter a word length:");

            input = Console.ReadLine();
            int           inputWordLength = int.Parse(input);
            List <string> selectedWords   = ListPractice.FindWord(words, inputWordLength);

            for (int i = 0; i < selectedWords.Count; i++)
            {
                Console.WriteLine(selectedWords[i]);
            }
            // bonus convert string to List
            string        sentence = "I would not, could not, in a box. I would not, could not with a fox. I will not eat them in a house. I will not eat them with a mouse.";
            List <string> result   = sentence.Split('.').ToList();

            for (int i = 0; i < result.Count; i++)
            {
                Console.WriteLine(result[i]);
            }
        }
        static void Main(string[] args)
        {
            List <int> lstNumbers = new List <int> {
                1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610
            };

            Console.WriteLine(ListPractice.GetSumEven(lstNumbers));

            string        aString   = "I would not, could not, in a box. I would not, could not with a fox. I will not eat them in a house.I will not eat them with a mouse.";
            List <string> result    = aString.Split(" ").ToList();
            List <string> lstString = new List <string> {
                "hello", "good", "thief", "steal", "bye", "time", "remote", "power"
            };

            Console.WriteLine("Search for words of what length?");
            string userInput = Console.ReadLine();

            ListPractice.Print5LetterWords(result, int.Parse(userInput));
        }