diff --git a/20240205/ConsoleApp1/.vs/ConsoleApp1/v16/.suo b/20240205/ConsoleApp1/.vs/ConsoleApp1/v16/.suo new file mode 100644 index 0000000..fddc197 Binary files /dev/null and b/20240205/ConsoleApp1/.vs/ConsoleApp1/v16/.suo differ diff --git a/20240205/ConsoleApp1/App.config b/20240205/ConsoleApp1/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20240205/ConsoleApp1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20240205/ConsoleApp1/ConsoleApp1.csproj b/20240205/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..9725d7b --- /dev/null +++ b/20240205/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {F8DF1118-704F-41A4-A645-2FAFC96EB37F} + Exe + ConsoleApp1 + ConsoleApp1 + 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/20240205/ConsoleApp1/ConsoleApp1.sln b/20240205/ConsoleApp1/ConsoleApp1.sln new file mode 100644 index 0000000..901c247 --- /dev/null +++ b/20240205/ConsoleApp1/ConsoleApp1.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33529.622 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1.csproj", "{F8DF1118-704F-41A4-A645-2FAFC96EB37F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F8DF1118-704F-41A4-A645-2FAFC96EB37F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8DF1118-704F-41A4-A645-2FAFC96EB37F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8DF1118-704F-41A4-A645-2FAFC96EB37F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8DF1118-704F-41A4-A645-2FAFC96EB37F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C04D3A23-72E7-4246-A9F1-83BCCCD63D0D} + EndGlobalSection +EndGlobal diff --git a/20240205/ConsoleApp1/Program.cs b/20240205/ConsoleApp1/Program.cs new file mode 100644 index 0000000..9eab182 --- /dev/null +++ b/20240205/ConsoleApp1/Program.cs @@ -0,0 +1,211 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; + +namespace ConsoleApp1 +{ + public class NapiMunka + { + public static int KeszultDb { get; private set; } + public int Nap { get; private set; } + public int HarangKesz { get; private set; } + public int HarangEladott { get; private set; } + public int AngyalkaKesz { get; private set; } + public int AngyalkaEladott { get; private set; } + public int FenyofaKesz { get; private set; } + public int FenyofaEladott { get; private set; } + + public NapiMunka(string sor) + { + string[] s = sor.Split(';'); + Nap = Convert.ToInt32(s[0]); + HarangKesz = Convert.ToInt32(s[1]); + HarangEladott = Convert.ToInt32(s[2]); + AngyalkaKesz = Convert.ToInt32(s[3]); + AngyalkaEladott = Convert.ToInt32(s[4]); + FenyofaKesz = Convert.ToInt32(s[5]); + FenyofaEladott = Convert.ToInt32(s[6]); + + NapiMunka.KeszultDb += HarangKesz + AngyalkaKesz + FenyofaKesz; + } + + public int NapiBevetel() + { + return -(HarangEladott * 1000 + AngyalkaEladott * 1350 + FenyofaEladott * 1500); + } + } + + public static class Data + { + public static List adatok = new List(); + } + + class Program + { + public static void AdatFeltolt() + { + FileStream fileStream = new FileStream("..\\diszek.txt", FileMode.Open, FileAccess.Read); + StreamReader streamReader = new StreamReader(fileStream); + + string sor = streamReader.ReadLine(); + while (sor != null) + { + NapiMunka melo = new NapiMunka(sor); + Data.adatok.Add(melo); + sor = streamReader.ReadLine(); + } + + streamReader.Close(); + fileStream.Close(); + } + + public static void Feladat4() + { + Console.WriteLine($"4.feladat: Összesen {NapiMunka.KeszultDb} darab dísz készült"); + } + + public static bool NemKeszultDisz() + { + foreach (var item in Data.adatok) + { + if (item.AngyalkaKesz == 0 && item.FenyofaKesz == 0 && item.HarangKesz == 0) + { + return true; + } + } + + return false; + } + public static void Feladat5() + { + if (NemKeszultDisz()) + { + Console.WriteLine($"5.feladat: Volt olyan nap amikor egyetlen dísz sem készült."); + } + else + { + Console.WriteLine($"5.feladat: Nem volt olyan nap amikor egyetlen dísz sem készült."); + } + + } + + public static int Beker() + { + Console.Write("Adja meg a keresett napot [1 ... 40]: "); + string str = Console.ReadLine(); + return int.Parse(str); + } + + public static int ValidBeker() + { + while (true) + { + int num = Beker(); + if (num < 41 && num > 0) + { + return num; + } + } + } + public static void Feladat6() + { + Console.WriteLine("6.feladat:"); + int num = ValidBeker(); + int harang = 0; + int angyal = 0; + int fenyo = 0; + + for (int i = 0; i < num; i++) + { + angyal += Data.adatok[i].AngyalkaKesz + Data.adatok[i].AngyalkaEladott; + harang += Data.adatok[i].HarangEladott + Data.adatok[i].HarangKesz; + fenyo += Data.adatok[i].FenyofaKesz + Data.adatok[i].FenyofaEladott; + } + + Console.WriteLine($"\tA(z) {num}. nap végén {harang} harang, {angyal} angyalka és {fenyo} fenyőfa maradt készleten."); + } + + public static int AngyalEladottdb() + { + int cntr = 0; + foreach (var item in Data.adatok) + { + cntr += item.AngyalkaEladott; + } + return cntr; + } + + public static int HaranglEladottdb() + { + int cntr = 0; + foreach (var item in Data.adatok) + { + cntr += item.HarangEladott; + } + return cntr; + } + + public static int FenyoEladottdb() + { + int cntr = 0; + foreach (var item in Data.adatok) + { + cntr += item.FenyofaEladott; + } + return cntr; + } + public static void Feladat7() + { + int harang = HaranglEladottdb(); + int fenyo = FenyoEladottdb(); + int angyal = AngyalEladottdb(); + int[] eladottak = { harang, fenyo, angyal }; + Console.WriteLine($"7.feladat: Legtöbbet eladott dísz: {Math.Abs(eladottak.Min())} darab"); + List indexek = new List(); + for (int i = 0; i < eladottak.Length; i++) + { + if (eladottak[i] == eladottak.Min()) + { + indexek.Add(i); + } + } + string[] megnevezesek = { "Harang", "Fenyőfa", "Angyalka" }; + foreach (var item in indexek) + { + Console.WriteLine($"\t{ megnevezesek[item]}"); + } + } + + public static void Feladat8() + { + FileStream fileStream = new FileStream("bevetel.txt", FileMode.Create, FileAccess.Write); + StreamWriter streamWriter = new StreamWriter(fileStream); + int cntr = 0; + foreach (var item in Data.adatok) + { + if (item.NapiBevetel() >= 10000) + { + cntr++; + streamWriter.WriteLine($"{item.Nap};{item.NapiBevetel()}"); + } + } + + streamWriter.WriteLine($"{cntr} napon volt legalább 10000 Ft a bevétel."); + streamWriter.Close(); + fileStream.Close(); + } + + static void Main(string[] args) + { + AdatFeltolt(); + Feladat4(); + Feladat5(); + Feladat6(); + Feladat7(); + Feladat8(); + } + } +} diff --git a/20240205/ConsoleApp1/Properties/AssemblyInfo.cs b/20240205/ConsoleApp1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..873b9d5 --- /dev/null +++ b/20240205/ConsoleApp1/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("ConsoleApp1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApp1")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[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("f8df1118-704f-41a4-a645-2fafc96eb37f")] + +// 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/20240205/ConsoleApp1/bevetel.txt b/20240205/ConsoleApp1/bevetel.txt new file mode 100644 index 0000000..7cb2de8 --- /dev/null +++ b/20240205/ConsoleApp1/bevetel.txt @@ -0,0 +1,17 @@ +6;13250 +11;13550 +14;10350 +16;14850 +17;12100 +18;16750 +23;13050 +24;17250 +28;16050 +29;21100 +30;20700 +31;17600 +33;11400 +36;11700 +38;11250 +39;14750 +16 napon volt legalább 10000 Ft a bevétel. diff --git a/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.exe b/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.exe new file mode 100644 index 0000000..06f3f49 Binary files /dev/null and b/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.exe differ diff --git a/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config b/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.pdb b/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.pdb new file mode 100644 index 0000000..5a0b56a Binary files /dev/null and b/20240205/ConsoleApp1/bin/Debug/ConsoleApp1.pdb differ diff --git a/20240205/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/20240205/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/20240205/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache new file mode 100644 index 0000000..f5e894a Binary files /dev/null and b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache differ diff --git a/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..ee191d7 --- /dev/null +++ b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +7f4b213b428f4c013f19137338418ee1f5525793 diff --git a/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..f6c47ac --- /dev/null +++ b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\bin\Debug\ConsoleApp1.exe.config +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\bin\Debug\ConsoleApp1.exe +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\bin\Debug\ConsoleApp1.pdb +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.AssemblyReference.cache +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\obj\Debug\ConsoleApp1.exe +C:\Users\szabomarton\Desktop\C#\20240205\ConsoleApp1\obj\Debug\ConsoleApp1.pdb diff --git a/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.exe b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.exe new file mode 100644 index 0000000..06f3f49 Binary files /dev/null and b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.exe differ diff --git a/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.pdb b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.pdb new file mode 100644 index 0000000..5a0b56a Binary files /dev/null and b/20240205/ConsoleApp1/obj/Debug/ConsoleApp1.pdb differ diff --git a/20240205/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/20240205/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..3c394aa Binary files /dev/null and b/20240205/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/20240205/Karácsony.pdf b/20240205/Karácsony.pdf new file mode 100644 index 0000000..8b27f5b Binary files /dev/null and b/20240205/Karácsony.pdf differ diff --git a/20240205/csharp.txt b/20240205/csharp.txt new file mode 100644 index 0000000..7ffd12c --- /dev/null +++ b/20240205/csharp.txt @@ -0,0 +1,30 @@ + class NapiMunka + { + public static int KeszultDb { get; private set; } + public int Nap { get; private set; } + public int HarangKesz { get; private set; } + public int HarangEladott { get; private set; } + public int AngyalkaKesz { get; private set; } + public int AngyalkaEladott { get; private set; } + public int FenyofaKesz { get; private set; } + public int FenyofaEladott { get; private set; } + + public NapiMunka(string sor) + { + string[] s = sor.Split(';'); + Nap = Convert.ToInt32(s[0]); + HarangKesz = Convert.ToInt32(s[1]); + HarangEladott = Convert.ToInt32(s[2]); + AngyalkaKesz = Convert.ToInt32(s[3]); + AngyalkaEladott = Convert.ToInt32(s[4]); + FenyofaKesz = Convert.ToInt32(s[5]); + FenyofaEladott = Convert.ToInt32(s[6]); + + NapiMunka.KeszultDb += HarangKesz + AngyalkaKesz + FenyofaKesz; + } + + public int NapiBevetel() + { + return -(HarangEladott * 1000 + AngyalkaEladott * 1350 + FenyofaEladott * 1500); + } + } \ No newline at end of file diff --git a/20240205/diszek.txt b/20240205/diszek.txt new file mode 100644 index 0000000..aa57ad9 --- /dev/null +++ b/20240205/diszek.txt @@ -0,0 +1,40 @@ +1;3;0;0;0;4;0 +2;4;0;5;-2;1;0 +3;1;-2;4;-3;0;0 +4;0;0;3;-1;0;0 +5;0;0;0;-2;3;-2 +6;0;-5;6;-5;0;-1 +7;3;0;3;0;1;-3 +8;2;-3;0;0;3;0 +9;5;0;6;-4;2;-3 +10;0;-3;0;0;8;-4 +11;2;-5;0;-3;1;-3 +12;0;-1;0;-2;0;0 +13;8;-3;0;-4;8;0 +14;0;0;0;-1;3;-6 +15;0;0;3;0;5;-4 +16;4;-6;2;-1;6;-5 +17;2;-4;8;-6;0;0 +18;0;-1;4;-5;3;-6 +19;0;0;1;-6;0;0 +20;2;-3;0;0;2;-4 +21;7;0;5;0;3;-3 +22;3;0;0;0;4;-4 +23;4;-6;5;-3;7;-2 +24;0;0;0;-5;8;-7 +25;0;0;6;-2;9;-4 +26;0;0;0;-4;5;0 +27;4;0;3;-2;0;0 +28;0;-6;2;-3;2;-4 +29;0;-4;4;-6;1;-6 +30;0;0;7;-2;0;-12 +31;0;-2;8;-6;0;-5 +32;10;0;0;-3;4;-2 +33;0;0;0;-4;3;-4 +34;5;-8;0;0;4;0 +35;2;0;9;-3;6;0 +36;0;-3;0;-2;8;-4 +37;0;0;6;-4;3;-2 +38;0;0;8;-5;6;-3 +39;3;-2;0;-5;5;-4 +40;2;-4;4;-3;2;0