Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace GerryTutor
- {
- class Program
- {
- static List<double> Union(List<double> a, List<double> b)
- {
- List<double> result = new List<double>();
- foreach (var item in a)
- {
- if (!result.Contains(item))
- {
- result.Add(item);
- }
- }
- foreach (var item in b)
- {
- if (!result.Contains(item))
- {
- result.Add(item);
- }
- }
- return result;
- }
- static List<int> NonRepeat(int[] arr)
- {
- HashSet<int> set = new HashSet<int>();
- foreach (var item in arr)
- {
- set.Add(item);
- }
- return set.ToList();
- }
- static void Main(string[] args)
- {
- /* Ex 8
- * string filename = Console.ReadLine();
- if (File.Exists(filename))
- {
- using (StreamReader reader = new StreamReader(filename))
- {
- string line;
- int cnt = 0;
- while ((line = reader.ReadLine()) != null)
- {
- cnt++;
- }
- Console.WriteLine($"Lines count: {cnt}");
- }
- }
- else
- {
- Console.WriteLine("File not found!");
- }*/
- HashSet<string> namesset = new HashSet<string>();
- using (StreamReader reader = new StreamReader("rats.txt"))
- {
- string line;
- while ((line = reader.ReadLine()) != null)
- {
- namesset.Add(line);
- }
- }
- using (StreamWriter writer = new StreamWriter("out.txt"))
- {
- foreach (var item in namesset)
- {
- writer.WriteLine(item);
- }
- Console.WriteLine("Writed....");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment