Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Home_Work
- {
- class Program
- {
- static void Main()
- {
- string[] source1 = { "Мама", "Папа", "Сын", "Дочь" };
- string[] source2 = { "Бабушка", "Дедушка", "Мама", "Папа" };
- List<string> words = new List<string>();
- FillListFromArray(words, source1);
- FillListFromArray(words, source2);
- ShowWords(words);
- }
- static void FillListFromArray(List<string> words, string[] source)
- {
- foreach (string word in source)
- {
- if (words.Contains(word) == false)
- {
- words.Add(word);
- }
- }
- }
- static void ShowWords(List<string> words)
- {
- foreach(string word in words)
- {
- Console.Write(word + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment