Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class DictionaryFirst
- {
- static List<string> words = new List<string>();
- static List<string> explanations = new List<string>();
- static void Splitting(string[] dictionary)
- {
- for (int i = 0; i < dictionary.Length; i++)
- {
- string[] dictsArray = dictionary[i].Split('-', '–');
- words.Add(dictsArray[0].ToUpper().Trim());
- explanations.Add(dictsArray[1]);
- }
- return;
- }
- static void Testing()
- {
- Console.Write("Please enter a word: ");
- string userInput = Console.ReadLine().ToUpper().Trim();
- for (int i = 0; i < words.Count; i++)
- {
- string str = words[i];
- if ((userInput == str) == true)
- {
- string answer = string.Format("{0} - {1}", words[i], explanations[i]);
- Console.WriteLine(answer);
- Environment.Exit(0);
- }
- }
- Console.WriteLine("The entered word can not be found");
- return;
- }
- static void Main()
- {
- string[] dictionary =
- {
- ".NET - platform for applications from Microsoft" ,
- "CLR - managed execution environment for .NET" ,
- "namespace – hierarchical organization of classes" ,
- };
- Splitting(dictionary);
- Testing();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement