From 3d6632e44a777e401fa345a5f63315632d358956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 13:50:09 +0200 Subject: [PATCH 1/7] =?UTF-8?q?Tanul=C3=B3=20oszt=C3=A1ly=20l=C3=A9trehoz?= =?UTF-8?q?=C3=A1sa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas.sln | 25 +++++++++++++++++++ .../ListaGyakorlas/ListaGyakorlas.csproj | 10 ++++++++ ListaGyakorlas/ListaGyakorlas/Program.cs | 10 ++++++++ ListaGyakorlas/ListaGyakorlas/Tanulo.cs | 25 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 ListaGyakorlas/ListaGyakorlas.sln create mode 100644 ListaGyakorlas/ListaGyakorlas/ListaGyakorlas.csproj create mode 100644 ListaGyakorlas/ListaGyakorlas/Program.cs create mode 100644 ListaGyakorlas/ListaGyakorlas/Tanulo.cs diff --git a/ListaGyakorlas/ListaGyakorlas.sln b/ListaGyakorlas/ListaGyakorlas.sln new file mode 100644 index 0000000..b6b0b67 --- /dev/null +++ b/ListaGyakorlas/ListaGyakorlas.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36930.0 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListaGyakorlas", "ListaGyakorlas\ListaGyakorlas.csproj", "{AF1538B4-B28F-4D91-8B0F-E1F25EFE8BD3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AF1538B4-B28F-4D91-8B0F-E1F25EFE8BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF1538B4-B28F-4D91-8B0F-E1F25EFE8BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF1538B4-B28F-4D91-8B0F-E1F25EFE8BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF1538B4-B28F-4D91-8B0F-E1F25EFE8BD3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FF53DBA6-C2A4-40A8-86A9-03B775534135} + EndGlobalSection +EndGlobal diff --git a/ListaGyakorlas/ListaGyakorlas/ListaGyakorlas.csproj b/ListaGyakorlas/ListaGyakorlas/ListaGyakorlas.csproj new file mode 100644 index 0000000..fd4bd08 --- /dev/null +++ b/ListaGyakorlas/ListaGyakorlas/ListaGyakorlas.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs new file mode 100644 index 0000000..675be50 --- /dev/null +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -0,0 +1,10 @@ +namespace ListaGyakorlas +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/ListaGyakorlas/ListaGyakorlas/Tanulo.cs b/ListaGyakorlas/ListaGyakorlas/Tanulo.cs new file mode 100644 index 0000000..ea875ef --- /dev/null +++ b/ListaGyakorlas/ListaGyakorlas/Tanulo.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ListaGyakorlas +{ + public class Tanulo + { + + public string Vezeteknev { get; set; } + public string Keresztnev { get; set; } + public string Osztaly { get; set; } + public int Eletkor { get; set; } + + public Tanulo(string vezeteknev, string keresztnev, string osztaly, int eletkor) + { + Vezeteknev = vezeteknev; + Keresztnev = keresztnev; + Osztaly = osztaly; + Eletkor = eletkor; + } + } +} From a3780df2c45a682f029dc7d6d1b0025ae4a11ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 13:55:32 +0200 Subject: [PATCH 2/7] =?UTF-8?q?Kiindul=C3=B3=20adatok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas/Program.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs index 675be50..4e14b39 100644 --- a/ListaGyakorlas/ListaGyakorlas/Program.cs +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -4,7 +4,14 @@ { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + string[] vezeteknevek = { "Kiss","Kósa","Horváth","Kovács","Zsiga","Németh"}; + string[] keresztnevek = { "Elza", "Anna", "Béla", "Bence", "Mátyás", "Ella" }; + + string[] osztalyok = { "9A", "9B", "10A", "10B", "11A", "11B","12A","12B" }; + + //életkor 14 és 19 közötti érték legyen + + List tanulok=new List(); } } } From 0ae661dc640e80d3869c74071bc6bc445d27f3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 14:01:12 +0200 Subject: [PATCH 3/7] =?UTF-8?q?Lista=20felt=C3=B6lt=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas/Program.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs index 4e14b39..729e261 100644 --- a/ListaGyakorlas/ListaGyakorlas/Program.cs +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -11,7 +11,25 @@ //életkor 14 és 19 közötti érték legyen + int darabszam = 200; + Random rand = new Random(); + + List tanulok=new List(); + + for (int i = 0; i < darabszam; i++) + { + string vezeteknev = vezeteknevek[rand.Next(0,vezeteknevek.Length)]; + string keresztnev = keresztnevek[rand.Next(0,keresztnevek.Length)]; + string osztaly = osztalyok[rand.Next(0, osztalyok.Length)]; + int eletkor = rand.Next(14, 20); + + tanulok.Add(new Tanulo(vezeteknev,keresztnev,osztaly,eletkor)); + } + + Console.WriteLine($"Lista hossza:{tanulok.Count}"); + + } } } From 76fba9ef9f98f6c193224d5bf80257ba47bcb60a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 14:14:17 +0200 Subject: [PATCH 4/7] =?UTF-8?q?Tanul=C3=B3=20keres=C3=A9se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas/Program.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs index 729e261..bea69a5 100644 --- a/ListaGyakorlas/ListaGyakorlas/Program.cs +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -29,6 +29,16 @@ Console.WriteLine($"Lista hossza:{tanulok.Count}"); + Console.Write("Adjon meg egy vezetéknevet:"); + string inVezeteknev=Console.ReadLine(); + Console.Write("Adjon meg egy keresztnevet:"); + string inKeresztnev = Console.ReadLine(); + + //Keressük meg, hogy van-e ilyen nevű tanuló! + + Tanulo tanulo = tanulok.Find(x=>x.Vezeteknev==inVezeteknev && x.Keresztnev==inKeresztnev); + + } } From 5b0df47f78f2bd9a1870d811a4c09cb6e89eb531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 14:23:01 +0200 Subject: [PATCH 5/7] =?UTF-8?q?Find=20haszn=C3=A1lata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas/Program.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs index bea69a5..fa683ab 100644 --- a/ListaGyakorlas/ListaGyakorlas/Program.cs +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -38,6 +38,17 @@ Tanulo tanulo = tanulok.Find(x=>x.Vezeteknev==inVezeteknev && x.Keresztnev==inKeresztnev); + if (tanulo!=null) + { + Console.WriteLine($"{tanulo.Vezeteknev} {tanulo.Keresztnev}"); + } else + { + Console.WriteLine("Nincs ilyen tanuló!"); + } + + + + } From 42e5109807a3b22ff1ed6d9971b57b84c411df61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 14:36:32 +0200 Subject: [PATCH 6/7] =?UTF-8?q?L=C3=A9tsz=C3=A1m=20meghat=C3=A1roz=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas/Program.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs index fa683ab..958051b 100644 --- a/ListaGyakorlas/ListaGyakorlas/Program.cs +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -46,9 +46,27 @@ Console.WriteLine("Nincs ilyen tanuló!"); } + //Hányan járnak a 10B osztályba? + //Klasszikus megoldás + int letszam10b = 0; + + for (int i = 0; i < tanulok.Count; i++) + { + if (tanulok[i].Osztaly=="10B") + { + letszam10b++; + } + } + + Console.WriteLine($"A 10b létszáma:{letszam10b}"); + + + //Megoldás a FindAll használatával + var letszam_10b = tanulok.FindAll(x => x.Osztaly == "10B").Count; + Console.WriteLine($"A 10b létszáma(findall):{letszam_10b}"); + - } From 17c273f27627800f8b4a096516609b8d2b7f71fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Rudolf?= Date: Wed, 14 Oct 2026 14:49:57 +0200 Subject: [PATCH 7/7] =?UTF-8?q?12b=20=C3=A1tlag=C3=A9letkora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaGyakorlas/ListaGyakorlas/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ListaGyakorlas/ListaGyakorlas/Program.cs b/ListaGyakorlas/ListaGyakorlas/Program.cs index 958051b..a038b88 100644 --- a/ListaGyakorlas/ListaGyakorlas/Program.cs +++ b/ListaGyakorlas/ListaGyakorlas/Program.cs @@ -65,6 +65,11 @@ var letszam_10b = tanulok.FindAll(x => x.Osztaly == "10B").Count; Console.WriteLine($"A 10b létszáma(findall):{letszam_10b}"); + //Mennyi a 12B tanulóinak átlagéletkora? + + var atlageletkor_12b = tanulok.FindAll(x => x.Osztaly == "12B").Average(x => x.Eletkor); + Console.WriteLine($"12b átlagéletkor:{atlageletkor_12b}"); +