From 080cb3c873d27e125e07b3a1f91773ddc6deee4a Mon Sep 17 00:00:00 2001 From: krajcsozsombor Date: Wed, 13 Sep 2023 11:19:02 +0200 Subject: [PATCH] =?UTF-8?q?4.k=C3=A9sz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index 743bf35..bd96d0e 100644 --- a/Program.cs +++ b/Program.cs @@ -16,6 +16,34 @@ namespace Balkezesek Console.WriteLine("A program indul!"); Program progi = new Program(); progi.Beolvasas(@"..\..\balkezesek.csv"); + progi.Feladat3(); + progi.Feladat4(); + progi.Feladat5(); + } + + public void Feladat5() + { + do + { + Console.WriteLine(); + } while (true); + } + + public void Feladat4() + { + Console.WriteLine("4.feladat:"); + foreach (var item in balkezesek) + { + if (item.utolso.StartsWith("1999-10")) + { + Console.WriteLine($"\t{item.nev}, {item.magassag*2.54:F1} cm"); + } + } + } + + public void Feladat3() + { + Console.WriteLine($"3.Feladat: {balkezesek.Count()}"); } public void Beolvasas(string filename) @@ -25,8 +53,17 @@ namespace Balkezesek { balkezesek.Add(new Dobo(sorok[i])); } - Console.WriteLine(balkezesek[balkezesek.Count-1].nev); + //Console.WriteLine(balkezesek[balkezesek.Count-1].nev); + } + public void BeolvasasSR(string filename) + { + StreamReader sr = new StreamReader(filename, Encoding.UTF8); + string elsosor = sr.ReadLine(); + while (!sr.EndOfStream) + { + balkezesek.Add(new Dobo(sr.ReadLine())); + } + sr.Close(); } - } }