From 32a8b9d2df4b4237d751bb855d6582e3eb53018d Mon Sep 17 00:00:00 2001 From: pp Date: Mon, 6 Feb 2023 14:51:53 +0100 Subject: [PATCH] =?UTF-8?q?A=20meccsdoga=20k=C3=A9szen=20van?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MeccsDoga/Program.cs | 67 +++++++++++++++++++++- MeccsDogaObject/App.config | 6 ++ MeccsDogaObject/Meccs.cs | 19 ++++++ MeccsDogaObject/MeccsDogaObject.csproj | 54 +++++++++++++++++ MeccsDogaObject/Program.cs | 24 ++++++++ MeccsDogaObject/Properties/AssemblyInfo.cs | 36 ++++++++++++ Tombok1.sln | 6 ++ 7 files changed, 209 insertions(+), 3 deletions(-) create mode 100644 MeccsDogaObject/App.config create mode 100644 MeccsDogaObject/Meccs.cs create mode 100644 MeccsDogaObject/MeccsDogaObject.csproj create mode 100644 MeccsDogaObject/Program.cs create mode 100644 MeccsDogaObject/Properties/AssemblyInfo.cs diff --git a/MeccsDoga/Program.cs b/MeccsDoga/Program.cs index f93a467..201641b 100644 --- a/MeccsDoga/Program.cs +++ b/MeccsDoga/Program.cs @@ -12,13 +12,74 @@ namespace MeccsDoga { static void Main(string[] args) { - //Beolvasás a merkozesek.tx fájlból 1. mód + //Beolvasás a merkozesek.txt fájlból 1. mód StreamReader sr = new StreamReader(@"c:\git\merkozesek.txt"); //egy sor beolvasása - string elsosor = sr.ReadLine(); - Console.WriteLine($"Az állomány első sora: {elsosor}"); + //string elsosor = sr.ReadLine(); + //Console.WriteLine($"Az állomány első sora: {elsosor}"); + string[] meccsek = new string[400]; + int darab = 0; + while(!sr.EndOfStream) + { + meccsek[darab] = sr.ReadLine(); + darab++; + } sr.Close(); + Console.WriteLine($"A fájlban {darab} meccs adata van."); + for (int i = 0; i < darab; i++) + { + Console.WriteLine(meccsek[i]); + } + //****************************************** + //Beolvasás a merkozesek.txt fájlból 2. mód + Console.WriteLine("Beolvasás 2. módszer ************************"); + string[] sorok = File.ReadAllLines(@"c:\git\merkozesek.txt"); + Console.WriteLine($"A fájlban {sorok.Length} meccs adata van."); + foreach (string sor in sorok) + { + Console.WriteLine(sor); + } + + //2. feladat megoldása + Console.WriteLine("Adja meg egy forduló számát (1-20):"); + string fordulo = Console.ReadLine(); + Console.WriteLine($"2. feladat:\nA {fordulo}. forduló mérkőzései:"); + foreach (var item in sorok) + { + if(item.StartsWith(fordulo)) + { + //Console.WriteLine(item); + string[] t = item.Split(' '); + Console.WriteLine($"{t[3]}-{t[4]}: {t[1]}-{t[2]}"); + } + } + + //3. feladat megoldása + Console.WriteLine("3. feladat:"); + int hazai = 0; + int vendeg = 0; + int remi = 0; + foreach (var item in sorok) + { + string[] t = item.Split(' '); + int hgol = int.Parse(t[1]); + int vgol = int.Parse(t[2]); + if(hgol>vgol) + { + hazai++; + } else if(vgol>hgol) + { + vendeg++; + } else + { + remi++; + } + } + Console.WriteLine($"Hazai győzelem: {hazai} mérkőzésen"); + Console.WriteLine($"Vendég győzelem: {vendeg} mérkőzésen"); + Console.WriteLine($"Döntetlen: {remi} mérkőzésen"); + } } } diff --git a/MeccsDogaObject/App.config b/MeccsDogaObject/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/MeccsDogaObject/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MeccsDogaObject/Meccs.cs b/MeccsDogaObject/Meccs.cs new file mode 100644 index 0000000..f54eb28 --- /dev/null +++ b/MeccsDogaObject/Meccs.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MeccsDogaObject +{ + class Meccs + { + public int fordulo; + public int hazaigol; + public int vendeggol; + public string hazaicsapat; + public string vendegcsapat; + private bool este; + + } +} diff --git a/MeccsDogaObject/MeccsDogaObject.csproj b/MeccsDogaObject/MeccsDogaObject.csproj new file mode 100644 index 0000000..2912432 --- /dev/null +++ b/MeccsDogaObject/MeccsDogaObject.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + {B0483911-FD39-46E1-BDA7-4773F1409664} + Exe + MeccsDogaObject + MeccsDogaObject + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MeccsDogaObject/Program.cs b/MeccsDogaObject/Program.cs new file mode 100644 index 0000000..3aeb6f0 --- /dev/null +++ b/MeccsDogaObject/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MeccsDogaObject +{ + class Program + { + static void Main(string[] args) + { + //A Meccs objektumok használata + Meccs m1 = new Meccs(); + m1.fordulo = 15; + m1.hazaigol = 2; + m1.vendeggol = 1; + m1.hazaicsapat = "gszisc"; + m1.vendegcsapat = "koosfc"; + Meccs m2 = new Meccs(); + + } + } +} diff --git a/MeccsDogaObject/Properties/AssemblyInfo.cs b/MeccsDogaObject/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7e45123 --- /dev/null +++ b/MeccsDogaObject/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MeccsDogaObject")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MeccsDogaObject")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b0483911-fd39-46e1-bda7-4773f1409664")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tombok1.sln b/Tombok1.sln index 77e4c0c..cbf3764 100644 --- a/Tombok1.sln +++ b/Tombok1.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tombok1", "Tombok1\Tombok1. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeccsDoga", "MeccsDoga\MeccsDoga.csproj", "{022E0B9A-7125-4EC5-9A08-115025405518}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeccsDogaObject", "MeccsDogaObject\MeccsDogaObject.csproj", "{B0483911-FD39-46E1-BDA7-4773F1409664}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {022E0B9A-7125-4EC5-9A08-115025405518}.Debug|Any CPU.Build.0 = Debug|Any CPU {022E0B9A-7125-4EC5-9A08-115025405518}.Release|Any CPU.ActiveCfg = Release|Any CPU {022E0B9A-7125-4EC5-9A08-115025405518}.Release|Any CPU.Build.0 = Release|Any CPU + {B0483911-FD39-46E1-BDA7-4773F1409664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0483911-FD39-46E1-BDA7-4773F1409664}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0483911-FD39-46E1-BDA7-4773F1409664}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0483911-FD39-46E1-BDA7-4773F1409664}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE