diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 58bbf6b5..415c5dd8 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -93,10 +93,23 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-033-NuGet", "src\Ap EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "ConsoleApp2\ConsoleApp2.csproj", "{18E65813-FB33-4C61-AAA7-8138DE19DE2A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp5", "ConsoleApp5\ConsoleApp5.csproj", "{729F75F3-6059-468C-A4EE-4412B1F8BC25}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp6", "ConsoleApp6\ConsoleApp6.csproj", "{6E24BADC-FEDA-419D-9A99-5444A95D728D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grafiti", "Grafiti\Grafiti.csproj", "{67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moje filmy", "Moje filmy\Moje filmy.csproj", "{3951A6B3-7ACE-446D-987C-812BB1AA3E37}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OOP_2.", "OOP_2\OOP_2..csproj", "{1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OOP_3.", "OOP_3\OOP_3..csproj", "{5608DCE5-07A1-4645-8E35-EC4CCFE93642}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hra_OOP", "Hra_OOP\Hra_OOP.csproj", "{0D7B0722-2D9C-4381-B87B-4677E0418A94}" +EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -226,18 +239,6 @@ Global {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x64.Build.0 = Release|Any CPU {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.ActiveCfg = Release|Any CPU {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.Build.0 = Release|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -634,6 +635,105 @@ Global {83C963FD-DC23-46E8-9545-F56197164810}.Release|x64.Build.0 = Release|Any CPU {83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.ActiveCfg = Release|Any CPU {83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.Build.0 = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x64.ActiveCfg = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x64.Build.0 = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x86.ActiveCfg = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Debug|x86.Build.0 = Debug|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|Any CPU.Build.0 = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x64.ActiveCfg = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x64.Build.0 = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x86.ActiveCfg = Release|Any CPU + {18E65813-FB33-4C61-AAA7-8138DE19DE2A}.Release|x86.Build.0 = Release|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Debug|Any CPU.Build.0 = Debug|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Debug|x64.ActiveCfg = Debug|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Debug|x64.Build.0 = Debug|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Debug|x86.ActiveCfg = Debug|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Debug|x86.Build.0 = Debug|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Release|Any CPU.ActiveCfg = Release|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Release|Any CPU.Build.0 = Release|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Release|x64.ActiveCfg = Release|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Release|x64.Build.0 = Release|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Release|x86.ActiveCfg = Release|Any CPU + {729F75F3-6059-468C-A4EE-4412B1F8BC25}.Release|x86.Build.0 = Release|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Debug|x64.ActiveCfg = Debug|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Debug|x64.Build.0 = Debug|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Debug|x86.ActiveCfg = Debug|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Debug|x86.Build.0 = Debug|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Release|Any CPU.Build.0 = Release|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Release|x64.ActiveCfg = Release|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Release|x64.Build.0 = Release|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Release|x86.ActiveCfg = Release|Any CPU + {6E24BADC-FEDA-419D-9A99-5444A95D728D}.Release|x86.Build.0 = Release|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Debug|x64.ActiveCfg = Debug|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Debug|x64.Build.0 = Debug|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Debug|x86.ActiveCfg = Debug|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Debug|x86.Build.0 = Debug|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Release|Any CPU.Build.0 = Release|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Release|x64.ActiveCfg = Release|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Release|x64.Build.0 = Release|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Release|x86.ActiveCfg = Release|Any CPU + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A}.Release|x86.Build.0 = Release|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Debug|x64.ActiveCfg = Debug|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Debug|x64.Build.0 = Debug|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Debug|x86.ActiveCfg = Debug|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Debug|x86.Build.0 = Debug|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Release|Any CPU.Build.0 = Release|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Release|x64.ActiveCfg = Release|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Release|x64.Build.0 = Release|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Release|x86.ActiveCfg = Release|Any CPU + {3951A6B3-7ACE-446D-987C-812BB1AA3E37}.Release|x86.Build.0 = Release|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Debug|x64.ActiveCfg = Debug|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Debug|x64.Build.0 = Debug|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Debug|x86.ActiveCfg = Debug|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Debug|x86.Build.0 = Debug|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Release|Any CPU.Build.0 = Release|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Release|x64.ActiveCfg = Release|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Release|x64.Build.0 = Release|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Release|x86.ActiveCfg = Release|Any CPU + {1502E2B1-4AF8-4CFA-A7E2-39DFA36198F4}.Release|x86.Build.0 = Release|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Debug|x64.ActiveCfg = Debug|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Debug|x64.Build.0 = Debug|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Debug|x86.ActiveCfg = Debug|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Debug|x86.Build.0 = Debug|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Release|Any CPU.Build.0 = Release|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Release|x64.ActiveCfg = Release|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Release|x64.Build.0 = Release|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Release|x86.ActiveCfg = Release|Any CPU + {5608DCE5-07A1-4645-8E35-EC4CCFE93642}.Release|x86.Build.0 = Release|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Debug|x64.ActiveCfg = Debug|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Debug|x64.Build.0 = Debug|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Debug|x86.ActiveCfg = Debug|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Debug|x86.Build.0 = Debug|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Release|Any CPU.Build.0 = Release|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Release|x64.ActiveCfg = Release|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Release|x64.Build.0 = Release|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Release|x86.ActiveCfg = Release|Any CPU + {0D7B0722-2D9C-4381-B87B-4677E0418A94}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {57860CA2-0054-465E-BD1E-024FF8D81354} = {56555FB0-B513-49EF-9002-A5AF135EA090} @@ -679,5 +779,11 @@ Global {7BEA7878-B5BA-4480-BC56-2F7B836F64B9} = {56555FB0-B513-49EF-9002-A5AF135EA090} {38FFE1DF-4B49-40C1-9908-51860BCF2D3E} = {56555FB0-B513-49EF-9002-A5AF135EA090} {83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {67C2C93F-DD0D-4FD6-9A3F-4DCE97F7C26A} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {3951A6B3-7ACE-446D-987C-812BB1AA3E37} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {0D7B0722-2D9C-4381-B87B-4677E0418A94} = {56555FB0-B513-49EF-9002-A5AF135EA090} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0463079C-E8B4-4F31-9B34-80769936C76B} EndGlobalSection EndGlobal diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp2/ConsoleApp2.csproj b/ConsoleApp2/ConsoleApp2.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp2/ConsoleApp2.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs new file mode 100644 index 00000000..fe91c201 --- /dev/null +++ b/ConsoleApp2/Program.cs @@ -0,0 +1,17 @@ +string[] names = new string[] { "Michal", "Matej", "Alex", "David", "Eva" }; +string[,] matrix = new string [ 30, 5 ]; +matrix [0, 2] = "Michal"; +matrix [1, 2] = "Matej"; +matrix [25, 4] = "Alex"; +matrix [29, 0] = "David"; +for (int i =0; i < 30; i++) +{ + for (int j = 0; j < 5; j++) + { + Console.WriteLine(matrix [i, j] + ", "); + } + Console.WriteLine(); +} + + + diff --git a/ConsoleApp3/ConsoleApp3.csproj b/ConsoleApp3/ConsoleApp3.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp3/ConsoleApp3.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp3/Program.cs b/ConsoleApp3/Program.cs new file mode 100644 index 00000000..83092b4c --- /dev/null +++ b/ConsoleApp3/Program.cs @@ -0,0 +1,17 @@ +string text = "quarty"; +taxt = "iny text"; +text += "dalsi text"; + +int vek = 5; +int vek1 = 10; +vek = 15; +vek += 5; + +if (vek > 18) +{ + Console.WriteLine("Si dospely"); +} +else +{ + Console.WriteLine("Som dieta "); +} \ No newline at end of file diff --git a/ConsoleApp4/ConsoleApp4.csproj b/ConsoleApp4/ConsoleApp4.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp4/ConsoleApp4.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp4/Program.cs b/ConsoleApp4/Program.cs new file mode 100644 index 00000000..2da0b00f --- /dev/null +++ b/ConsoleApp4/Program.cs @@ -0,0 +1,18 @@ + +string text = "quarty"; +taxt = "iny text"; +text += "dalsi text"; + +int vek = 5; +int vek1 = 10; +vek = 15; +vek += 5; + +if (vek > 18) +{ + Console.WriteLine("Si dospely"); +} +else +{ + Console.WriteLine("Som dieta "); +} \ No newline at end of file diff --git a/ConsoleApp5/ConsoleApp5.csproj b/ConsoleApp5/ConsoleApp5.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp5/ConsoleApp5.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp5/Program.cs b/ConsoleApp5/Program.cs new file mode 100644 index 00000000..e2212e86 --- /dev/null +++ b/ConsoleApp5/Program.cs @@ -0,0 +1,93 @@ +/* +string i = "*"; +while (i.Length < 6) +{ + Console.WriteLine(i); + i = "*"; +} +string j = "*****"; +while (j.Length > 0) +{ + Console.WriteLine(j); + j = j.Substring(0, j.Length -1); +} +*/ + + +/* +int[] cislo = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +int i = 0; +int vysledok = 0; +for (i = 0; i < cislo.Length; i++) +{ + vysledok += cislo[i]; +} +Console.WriteLine(vysledok); +*/ + + +/* +string[] names = { "Dnes", "sa", "mam", "dobre" }; +foreach (string name in names) +{ + Console.Write($" {name} "); +} +*/ + + +/* +List numbers = new List(); +Console.WriteLine("Zadaj cislo"); +string vstup = Console.ReadLine(); + +while (vstup != "+") +{ + numbers.Add(int.Parse(vstup)); + Console.WriteLine("Zadaj cislo"); + vstup = Console.ReadLine(); +} + + Console.WriteLine("Vysledok scitania:"); + int sucet = 0; + foreach (int i in numbers) + { + sucet += i; + } + Console.WriteLine(sucet); +*/ + + +/* +Console.WriteLine("Zadaj svoje meno"); +string meno = Console.ReadLine(); +Console.WriteLine("Zadaj svoj vek"); +string vek =Console.ReadLine(); +*/ + + +/* +string meno = ZiskajMeno(); +string vek = ZiskajVek(); + +VypisUdaje(meno, vek); + +string ZiskajMeno() +{ + Console.WriteLine("Zadaj meno"); + string meno = Console.ReadLine(); + return meno; +} + + +string ZiskajVek() +{ + Console.WriteLine("Zadaj vek"); + string vek = Console.ReadLine(); + return vek; +} + +void VypisUdaje(string meno, string vek) +{ + Console.WriteLine($"Ahoj {meno}, tvoj vek je {vek} rokov."); +} +*/ diff --git a/ConsoleApp6/ConsoleApp6.csproj b/ConsoleApp6/ConsoleApp6.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp6/ConsoleApp6.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp6/Program.cs b/ConsoleApp6/Program.cs new file mode 100644 index 00000000..ed5877f3 --- /dev/null +++ b/ConsoleApp6/Program.cs @@ -0,0 +1,349 @@ + +// uvod +Console.WriteLine("Vitaj v mojej prvej hre!"); +Console.WriteLine("Ide o to, ze bude tvoj charakter bojovat s priserami."); +Console.WriteLine("Ked nejaku zabijes tak dostanes veci v inventary ktore mozes pouzit. No vzdy si mozes vybrat len 1 vec!"); +Console.WriteLine("Mozes si vybrat: Hp potion na 5 sekund ( 10% viac zivota) alebo mec (dava 5% viac damage)."); +Console.WriteLine("Veci v inventari sa nepocitaju do vlasnosti postavy, ale mozes ich pouzit v boji LEN V 1. UTOKU!"); +Console.WriteLine("Ak chces pouzit vec z inventara, napis jej meno presne ako je v zozname!"); +Console.WriteLine($"Veci v inventari su: 'Hp potion' a 'Mec'."); +Console.WriteLine("Ak chces pokracovat bez pouzitia veci, napis 'nic'."); +// + + +//vlasnosti +Console.WriteLine("Zadaj meno svojho charakteru: "); +string meno = Console.ReadLine(); +int sila = 30; +int zivot = 90; +Console.WriteLine($"Tvoj charakter sa vola {meno}, ma silu {sila} a zivot {zivot}."); +Console.WriteLine("Zadaj meno nepriatela: "); +string nepriatelMeno = Console.ReadLine(); +int nepriatelSila = 20; +int nepriatelZivot = 60; +Console.WriteLine($"Tvoj nepriatel sa vola {nepriatelMeno}, ma silu {nepriatelSila} a zivot {nepriatelZivot}. "); +Console.WriteLine("Takze ideme na to!"); +// +Console.WriteLine("Ak chces otvorit inventar tak napis : M; a ak inventar nechces tak napis : K."); +string InvOpen3 = (Console.ReadLine()); +Console.WriteLine("Inventar mas pazdny; ak chces nieco dostat tak musis vyhrat boj!"); +// + + + +// prva arena +while (zivot > 0 && nepriatelZivot > 0) + { + Console.WriteLine("Stlac enter pre spustenie utoku!"); + Console.ReadLine(); + Console.WriteLine($"{nepriatelMeno} zautocil na teba a zranil ta o {nepriatelSila} zivotov."); + zivot -= nepriatelSila; + if (zivot < 0) zivot = 0; + Console.WriteLine($"Tvoj zivot je teraz {zivot}. "); + if (zivot <= 0) + { + Console.WriteLine("Prehral si!"); + break; + } + Console.WriteLine($"Stlac enter aby {meno} zautocil na {nepriatelMeno}!"); + Console.ReadLine(); + Console.WriteLine($"{meno} zautocil na {nepriatelMeno} a zranil si ho o {sila} zivotov."); + nepriatelZivot -= sila; + if (nepriatelZivot < 0) nepriatelZivot = 0; + Console.WriteLine($"Zivot {nepriatelMeno} je teraz {nepriatelZivot}."); + if (nepriatelZivot <= 0) + { + Console.WriteLine($"Porazil si {nepriatelMeno} a postupujes do 2. areny!"); + } + } +// + + +//pouzitie inventara v 1. arene +List inventar = new List(); +Console.WriteLine("Ak chces otvorit inventar tak napis : M; a ak inventar nechces tak napis : K."); +string InvOpen = (Console.ReadLine()); +if (InvOpen.ToString().ToUpper() == "M") +{ + Console.WriteLine("Gratulujem.teraz si mozes vybrat vec z inventara."); + Console.WriteLine("Zadaj nazov veci ktoru chces pouzit: "); + string vec = Console.ReadLine(); + inventar.Add(vec); +} +else if (InvOpen.ToString().ToUpper() == "K") +{ + Console.WriteLine("Pokračujes bez použitia inventara."); +} +else +{ + Console.WriteLine("Zadal si zlu klavesu, skus to znova!"); + InvOpen = (Console.ReadLine()); +} + + + + + // + + + //pouzitie potionu v 1. arene + if (inventar.Contains("Hp potion")) +{ + Console.WriteLine("Chces pouzit Hp potion? Ak ano napis : Yes; ak nie napis : No."); + string pouzitPotion = (Console.ReadLine()); + if (pouzitPotion.ToString().ToUpper() == "Yes") + { + Console.WriteLine("Pouzil si Hp potion a tvoj zivot sa zvysil o 10% na 99 zivotov."); + inventar.Remove("Hp potion"); + inventar.Add("token zivota"); + } + else if (pouzitPotion.ToString().ToUpper() == "No") + Console.WriteLine("Pokračujes bez použitia potionu."); + else + Console.WriteLine("Zadal si zle slovo, skus to znova!"); +} + +else if (InvOpen.ToString().ToUpper() == "K") + Console.WriteLine("Pokračujes bez použitia inventara."); +// + + +// pouzitie meca v 1. arene +if (inventar.Contains("Mec")) +{ + Console.WriteLine("Chces pouzit Mec? Ak ano napis : Yes; ak nie napis : No."); + string pouzitMec = (Console.ReadLine()); + if (pouzitMec.ToString().ToUpper() == "Yes") + { + Console.WriteLine("Pouzil si Mec a tvoja sila sa zvysila o 5% na 33 sily."); + inventar.Remove("Mec"); + inventar.Add("token sily"); + } + else if (pouzitMec.ToString().ToUpper() == "No") + Console.WriteLine("Pokračujes bez použitia meca."); + + // + + + // vlasnosti 2. areny + int sila1 = 30; + int zivot1 = 90; + Console.WriteLine($"{meno} ma silu {sila1} a zivot {zivot1}. "); + int nepriatelSila1 = 25; + int nepriatelZivot1 = 65; + Console.WriteLine($"{nepriatelMeno} ma silu {nepriatelSila1} a zivot {nepriatelZivot1}. "); + Console.WriteLine("Takze ideme na to!"); + // + + + //pouzitie inventara v 2. arene + List inventar1 = new List(); + Console.WriteLine("Ak chces otvorit inventar tak napis : M; a ak inventar nechces tak napis : K."); + string InvOpen1 = (Console.ReadLine()); + if (InvOpen1.ToString().ToUpper() == "M") + { + Console.WriteLine("Gratulujem.teraz si mozes vybrat vec z inventara."); + Console.WriteLine("Zadaj nazov veci ktoru chces pouzit: "); + string vec = Console.ReadLine(); + inventar1.Add(vec); + } + else if (InvOpen1.ToString().ToUpper() == "K") + { + Console.WriteLine("Pokračujes bez použitia inventara."); + } + else + { + Console.WriteLine("Zadal si zlu klavesu, skus to znova!"); + InvOpen1 = (Console.ReadLine()); + } + // + + + // druha arena + while (zivot1 > 0 && nepriatelZivot1 > 0) + { + Console.WriteLine("Stlac enter pre spustenie utoku!"); + Console.ReadLine(); + Console.WriteLine($"{nepriatelMeno} zautocil na teba a zranil ta o {nepriatelSila1} zivotov."); + zivot1 -= nepriatelSila1; + if (zivot1 < 0) zivot1 = 0; + Console.WriteLine($"Tvoj zivot je teraz {zivot1}. "); + if (zivot1 <= 0) + { + Console.WriteLine("Prehral si!"); + break; + } + Console.WriteLine($"Stlac enter aby {meno} zautocil na {nepriatelMeno}!"); + Console.ReadLine(); + Console.WriteLine($"{meno} zautocil na {nepriatelMeno} a zranil si ho o {sila1}."); + nepriatelZivot1 -= sila1; + if (nepriatelZivot1 < 0) nepriatelZivot1 = 0; + Console.WriteLine($"Zivot {nepriatelMeno} je teraz {nepriatelZivot1}."); + if (nepriatelZivot1 <= 0) + { + Console.WriteLine($"Porazil si {nepriatelMeno} a postupujes do 3. areny!"); + } + } + // + + + //pouzitie potionu v 2. arene + if (inventar.Contains("Hp potion")) + { + Console.WriteLine("Chces pouzit Hp potion? Ak ano napis : Yes; ak nie napis : No."); + char pouzitPotion = char.Parse(Console.ReadLine()); + if (pouzitPotion.ToString().ToUpper() == "Yes") + { + Console.WriteLine("Pouzil si Hp potion a tvoj zivot sa zvysil o 10% na 99 zivotov."); + inventar.Remove("Hp potion"); + inventar.Add("token zivota"); + } + else if (pouzitPotion.ToString().ToUpper() == "No") + Console.WriteLine("Pokračujes bez použitia potionu."); + else + Console.WriteLine("Zadal si zle slovo, skus to znova!"); + } + + else if (InvOpen.ToString().ToUpper() == "K") + Console.WriteLine("Pokračujes bez použitia inventara."); + // + + + // pouzitie meca v 2. arene + if (inventar.Contains("Mec")) + { + Console.WriteLine("Chces pouzit Mec? Ak ano napis : Yes; ak nie napis : No."); + char pouzitMec1 = char.Parse(Console.ReadLine()); + if (pouzitMec1.ToString().ToUpper() == "Yes") + { + Console.WriteLine("Pouzil si Mec a tvoja sila sa zvysila o 5% na 33 sily."); + inventar.Remove("Mec"); + inventar.Add("token sily"); + } + else if (pouzitMec1.ToString().ToUpper() == "No") + Console.WriteLine("Pokračujes bez použitia meca."); + + // + + + // nepouzil si nic v 2. arene + if (!inventar.Contains("Hp potion") && !inventar.Contains("Mec")) + { + Console.WriteLine("Pokračujes bez použitia inventara."); + } + // + + + //pouzitie inventara v 3. arene + List inventar2 = new List(); + Console.WriteLine("Ak chces otvorit inventar tak napis : M; a ak inventar nechces tak napis : K."); + char InvOpen2 = char.Parse(Console.ReadLine()); + if (InvOpen2.ToString().ToUpper() == "M") + { + Console.WriteLine("Inventar mas pazdny; ak chces nieco dostat tak musis vyhrat boj!"); + } + + else if (InvOpen2.ToString().ToUpper() == "K") + { + Console.WriteLine("Pokračujes bez použitia inventara."); + } + // + + + // vlasnosti 3. areny + int sila2 = 30; + int zivot2 = 90; + Console.WriteLine($"{meno} ma silu {sila2} a zivot {zivot2}. "); + int nepriatelSila2 = 28; + int nepriatelZivot2 = 75; + Console.WriteLine($"{nepriatelMeno} ma silu {nepriatelSila2} a zivot {nepriatelZivot2}. "); + Console.WriteLine("Takze ideme na to!"); + // + + + // tretia arena + while (zivot2 > 0 && nepriatelZivot2 > 0) + { + Console.WriteLine("Stlac enter pre spustenie utoku!"); + Console.ReadLine(); + Console.WriteLine($"{nepriatelMeno} zautocil na teba a zranil ta o {nepriatelSila2} zivotov."); + zivot2 -= nepriatelSila2; + if (zivot2 < 0) zivot2 = 0; + Console.WriteLine($"Tvoj zivot je teraz {zivot2}. "); + if (zivot2 <= 0) + { + Console.WriteLine("Prehral si!"); + break; + } + Console.WriteLine($"Stlac enter aby {meno} zautocil na {nepriatelMeno}"); + Console.ReadLine(); + Console.WriteLine($"{meno} zautocil na {nepriatelMeno} a zranil si ho o {sila2} zivotov"); + nepriatelZivot2 -= sila2; + if (nepriatelZivot2 < 0) nepriatelZivot2 = 0; + Console.WriteLine($"Zivot {nepriatelMeno} je teraz {nepriatelZivot2}"); + if (nepriatelZivot2 <= 0) + { + Console.WriteLine($"Porazil si {nepriatelMeno} a vyhral si hru! Gratulujem!"); + } + } + + + // bonusova aréna + Console.WriteLine("Gratulujem ze si vyhral hru! Ak chces pokracovat do bonusovej areny tak napis : Y; ak nie napis : N."); + Console.ReadLine(); + if (InvOpen2.ToString().ToUpper() == "Y") + Console.WriteLine("Pokračujes do bonusovej arény!"); + { + + Console.WriteLine("Vitaj v bonusovej arene!"); + Console.WriteLine("Tvoj nepriatel v bonusovej arene bude matematika!"); + Console.WriteLine("Tvojou ulohou je vyriesit 3 priklady spravne aby si vyhral bonusovu arenu!"); + int score = 0; + Console.WriteLine("Priklad 1: Kolko je 5 + 8 * 4 ?"); + int answer1 = int.Parse(Console.ReadLine()); + if (answer1 == 37) + { + score++; + Console.WriteLine("Spravne!"); + } + else + { + Console.WriteLine("Nespravne!"); + } + Console.WriteLine("Priklad 2: Kolko je (10 + 5) / 5 * 16 ?"); + int answer2 = int.Parse(Console.ReadLine()); + if (answer2 == 48) + { + score++; + Console.WriteLine("Spravne!"); + } + else + { + Console.WriteLine("Nespravne!"); + } + Console.WriteLine("Priklad 3: Kolko je 18 + 2 ?"); + int answer3 = int.Parse(Console.ReadLine()); + if (answer3 == 20) + { + score++; + Console.WriteLine("Spravne!"); + } + else + { + Console.WriteLine("Nespravne!"); + } + if (score == 3) + { + Console.WriteLine("Gratulujem! Vyriesil si vsetky priklady spravne a vyhral bonusovu arenu!"); + } + else + { + Console.WriteLine($"Vyriesil si {score} z 3 prikladov spravne. Skus to znova nabuduce!"); + } + } + } +} + + + + diff --git a/Grafiti/Grafiti.csproj b/Grafiti/Grafiti.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Grafiti/Grafiti.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Grafiti/Program.cs b/Grafiti/Program.cs new file mode 100644 index 00000000..6d317e80 --- /dev/null +++ b/Grafiti/Program.cs @@ -0,0 +1,954 @@ + +Console.BackgroundColor = ConsoleColor.Black; +Console.ForegroundColor = ConsoleColor.White; + +Console.WriteLine("Zadajte text: "); +string input = Console.ReadLine(); +string output = ""; +string[,] matrix = new string[100, 200]; +int offset = 0; + +foreach (char inputLetter in input) +{ + string outLetter = GetLetter(inputLetter.ToString()); + string[] lines = outLetter.Split(Environment.NewLine); + int letterWidth = 0; + + for (int i = 0; i < lines.Length; i++) + { + string character = lines[i]; + letterWidth = Math.Max(lines[i].Length, letterWidth); + + for (int j = 0; j < character.Length; j++) + { + matrix[i, j + offset] = character[j].ToString(); + } + } + offset = offset + letterWidth; +} + +for (int i = 0; i < matrix.GetLength(0); i++) +{ + for (int j = 0;j < matrix.GetLength(1); j++) + { + Console.Write(matrix[i, j]); + } + Console.WriteLine(); +} + + +string GetLetter(string input) +{ + switch (input) + { + case "A": + case "a": + return GetLetterA(); + case "B": + case "b": + return GetLetterB(); + case "C": + case "c": + return GetLetterC(); + case "D": + case "d": + return GetLetterD(); + case "E": + case "e": + return GetLetterE(); + case "F": + case "f": + return GetLetterF(); + case "G": + case "g": + return GetLetterG(); + case "H": + case "h": + return GetLetterH(); + case "I": + case "i": + return GetLetterI(); + case "J": + case "j": + return GetLetterJ(); + case "K": + case "k": + return GetLetterK(); + case "L": + case "l": + return GetLetterL(); + case "M": + case "m": + return GetLetterM(); + case "N": + case "n": + return GetLetterN(); + case "O": + case "o": + return GetLetterO(); + case "P": + case "p": + return GetLetterP(); + case "R": + case "r": + return GetLetterR(); + case "S": + case "s": + return GetLetterS(); + case "T": + case "t": + return GetLetterT(); + case "U": + case "u": + return GetLetterU(); + case "V": + case "v": + return GetLetterV(); + case "W": + case "w": + return GetLetterW(); + case "X": + case "x": + return GetLetterX(); + case "Y": + case "y": + return GetLetterY(); + case "Z": + case "z": + return GetLetterZ(); + + case "0": + return GetNumber0(); + case "1": + return GetNumber1(); + case "2": + return GetNumber2(); + case "3": + return GetNumber3(); + case "4": + return GetNumber4(); + case "5": + return GetNumber5(); + case "6": + return GetNumber6(); + case "7": + return GetNumber7(); + case "8": + return GetNumber8(); + case "9": + return GetNumber9(); + default: + return "Pismeno nie je podporovane."; + } +} + string GetLetterA() +{ + return @" + + AAA + A:::A + A:::::A + A:::::::A + A:::::::::A + A:::::A:::::A + A:::::A A:::::A + A:::::A A:::::A + A:::::A A:::::A + A:::::AAAAAAAAA:::::A + A:::::::::::::::::::::A + A:::::AAAAAAAAAAAAA:::::A + A:::::A A:::::A + A:::::A A:::::A + A:::::A A:::::A +AAAAAAA AAAAAAA + + "; +} +string GetLetterB() +{ + return @" + +BBBBBBBBBBBBBBBBB +B::::::::::::::::B +B::::::BBBBBB:::::B +BB:::::B B:::::B + B::::B B:::::B + B::::B B:::::B + B::::BBBBBB:::::B + B:::::::::::::BB + B::::BBBBBB:::::B + B::::B B:::::B + B::::B B:::::B + B::::B B:::::B +BB:::::BBBBBB::::::B +B:::::::::::::::::B +B::::::::::::::::B +BBBBBBBBBBBBBBBBB + +"; +} +string GetLetterC() +{ + return @" + + CCCCCCCCCCCCC + CCC::::::::::::C + CC:::::::::::::::C + C:::::CCCCCCCC::::C + C:::::C CCCCCC +C:::::C +C:::::C +C:::::C +C:::::C +C:::::C +C:::::C + C:::::C CCCCCC + C:::::CCCCCCCC::::C + CC:::::::::::::::C + CCC::::::::::::C + CCCCCCCCCCCCC + +"; +} +string GetLetterD() +{ + return @" + +DDDDDDDDDDDDD +D::::::::::::DDD +D:::::::::::::::DD +DDD:::::DDDDD:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D + D:::::D D:::::D +DDD:::::DDDDD:::::D +D:::::::::::::::DD +D::::::::::::DDD +DDDDDDDDDDDDD + + "; +} +string GetLetterE() +{ + return @" + +EEEEEEEEEEEEEEEEEEEEEE +E::::::::::::::::::::E +E::::::::::::::::::::E +EE::::::EEEEEEEEE::::E + E:::::E EEEEEE + E:::::E + E::::::EEEEEEEEEE + E:::::::::::::::E + E:::::::::::::::E + E::::::EEEEEEEEEE + E:::::E + E:::::E EEEEEE +EE::::::EEEEEEEE:::::E +E::::::::::::::::::::E +E::::::::::::::::::::E +EEEEEEEEEEEEEEEEEEEEEE + +"; +} +string GetLetterF() +{ + return @" + +FFFFFFFFFFFFFFFFFFFFFF +F::::::::::::::::::::F +F::::::::::::::::::::F +FF::::::FFFFFFFFF::::F + F:::::F FFFFFF + F:::::F + F::::::FFFFFFFFFF + F:::::::::::::::F + F:::::::::::::::F + F::::::FFFFFFFFFF + F:::::F + F:::::F +FF:::::::FF +F::::::::FF +F::::::::FF +FFFFFFFFFFF + +"; +} +string GetLetterG() +{ + return @" + + GGGGGGGGGGGGG + GGG::::::::::::G + GG:::::::::::::::G + G:::::GGGGGGGG::::G + G:::::G GGGGGG +G:::::G +G:::::G +G:::::G GGGGGGGGGG +G:::::G G::::::::G +G:::::G GGGGG::::G +G:::::G G::::G + G:::::G G::::G + G:::::GGGGGGGG::::G + GG:::::::::::::::G + GGG::::::GGG:::G + GGGGGG GGGG + + "; +} +string GetLetterH() +{ + return @" + +HHHHHHHHH HHHHHHHHH +H:::::::H H:::::::H +H:::::::H H:::::::H +HH::::::H H::::::HH + H:::::H H:::::H + H:::::H H:::::H + H::::::HHHHH::::::H + H:::::::::::::::::H + H:::::::::::::::::H + H::::::HHHHH::::::H + H:::::H H:::::H + H:::::H H:::::H +HH::::::H H::::::HH +H:::::::H H:::::::H +H:::::::H H:::::::H +HHHHHHHHH HHHHHHHHH + + "; +} +string GetLetterI() +{ + return @" + +IIIIIIIIII +I::::::::I +I::::::::I +II::::::II + I::::I + I::::I + I::::I + I::::I + I::::I + I::::I + I::::I + I::::I +II::::::II +I::::::::I +I::::::::I +IIIIIIIIII + +"; +} +string GetLetterJ() +{ + return @" + + JJJJJJJJJJJ + J:::::::::J + J:::::::::J + JJ:::::::JJ + J:::::J + J:::::J + J:::::J + J:::::j + J:::::J +JJJJJJJ J:::::J +J:::::J J:::::J +J::::::J J::::::J +J:::::::JJJ:::::::J + JJ:::::::::::::JJ + JJ:::::::::JJ + JJJJJJJJJ + + "; +} +string GetLetterK() +{ + return @" + +KKKKKKKKK KKKKKKK +K:::::::K K:::::K +K:::::::K K:::::K +K:::::::K K::::::K +KK::::::K K:::::KKK + K:::::K K:::::K + K::::::K:::::K + K:::::::::::K + K:::::::::::K + K::::::K:::::K + K:::::K K:::::K +KK::::::K K:::::KKK +K:::::::K K::::::K +K:::::::K K:::::K +K:::::::K K:::::K +KKKKKKKKK KKKKKKK + + "; +} +string GetLetterL() +{ + return @" + +LLLLLLLLLLL +L:::::::::L +L:::::::::L +LL:::::::LL + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L + L:::::L LLLLLL +LL:::::::LLLLLLLLL:::::L +L::::::::::::::::::::::L +L::::::::::::::::::::::L +LLLLLLLLLLLLLLLLLLLLLLLL + + "; +} +string GetLetterM() +{ + return @" + +MMMMMMMM MMMMMMMM +M:::::::M M:::::::M +M::::::::M M::::::::M +M:::::::::M M:::::::::M +M::::::::::M M::::::::::M +M:::::::::::M M:::::::::::M +M:::::::M::::M M::::M:::::::M +M::::::M M::::M M::::M M::::::M +M::::::M M::::M::::M M::::::M +M::::::M M:::::::M M::::::M +M::::::M M:::::M M::::::M +M::::::M MMMMM M::::::M +M::::::M M::::::M +M::::::M M::::::M +M::::::M M::::::M +MMMMMMMM MMMMMMMM + + "; +} +string GetLetterN() +{ + return @" + +NNNNNNNN NNNNNNNN +N:::::::N N::::::N +N::::::::N N::::::N +N:::::::::N N::::::N +N::::::::::N N::::::N +N:::::::::::N N::::::N +N:::::::N::::N N::::::N +N::::::N N::::N N::::::N +N::::::N N::::N:::::::N +N::::::N N:::::::::::N +N::::::N N::::::::::N +N::::::N N:::::::::N +N::::::N N::::::::N +N::::::N N:::::::N +N::::::N N::::::N +NNNNNNNN NNNNNNN + +"; +} +string GetLetterO() +{ + return @" + + OOOOOOOOO + OO:::::::::OO + OO:::::::::::::OO +O:::::::OOO:::::::O +O::::::O O::::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O:::::O O:::::O +O::::::O O::::::O +O:::::::OOO:::::::O + OO:::::::::::::OO + OO:::::::::OO + OOOOOOOOO + + "; +} +string GetLetterP() +{ + return @" + +PPPPPPPPPPPPPPPPP +P::::::::::::::::P +P::::::PPPPPP:::::P +PP:::::P P:::::P + P::::P P:::::P + P::::P P:::::P + P::::PPPPPP:::::P + P:::::::::::::PP + P::::PPPPPPPPP + P::::P + P::::P + P::::P +PP::::::PP +P::::::::P +P::::::::P +PPPPPPPPPP + +"; +} +string GetLetterR() +{ + return @" + +RRRRRRRRRRRRRRRRR +R::::::::::::::::R +R::::::RRRRRR:::::R +RR:::::R R:::::R + R::::R R:::::R + R::::R R:::::R + R::::RRRRRR:::::R + R:::::::::::::RR + R::::RRRRRR:::::R + R::::R R:::::R + R::::R R:::::R + R::::R R:::::R +RR:::::R R:::::R +R::::::R R:::::R +R::::::R R:::::R +RRRRRRRR RRRRRRR + + "; +} +string GetLetterS() +{ + return @" + + SSSSSSSSSSSSSSS + SS:::::::::::::::S +S:::::SSSSSS::::::S +S:::::S SSSSSSS +S:::::S +S:::::S + S::::SSSS + SS::::::SSSSS + SSS::::::::SS + SSSSSS::::S + S:::::S + S:::::S +SSSSSSS S:::::S +S::::::SSSSSS:::::S +S:::::::::::::::SS + SSSSSSSSSSSSSSS + +"; +} +string GetLetterT() +{ + return @" + +TTTTTTTTTTTTTTTTTTTTTTT +T:::::::::::::::::::::T +T:::::::::::::::::::::T +T:::::TT:::::::TT:::::T +TTTTTT T:::::T TTTTTT + T:::::T + T:::::T + T:::::T + T:::::T + T:::::T + T:::::T + T:::::T + TT:::::::TT + T:::::::::T + T:::::::::T + TTTTTTTTTTT + + "; +} +string GetLetterU() +{ + return @" + +UUUUUUUU UUUUUUUU +U::::::U U::::::U +U::::::U U::::::U +UU:::::U U:::::UU + U:::::U U:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U:::::D D:::::U + U::::::U U::::::U + U:::::::UUU:::::::U + UU:::::::::::::UU + UU:::::::::UU + UUUUUUUUU + + "; +} +string GetLetterV() +{ + return @" + +VVVVVVVV VVVVVVVV +V::::::V V::::::V +V::::::V V::::::V +V::::::V V::::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V V:::::V + V:::::V:::::V + V:::::::::V + V:::::::V + V:::::V + V:::V + VVV + +"; +} +string GetLetterW() +{ + return @" + +WWWWWWWW WWWWWWWW +W::::::W W::::::W +W::::::W W::::::W +W::::::W W::::::W + W:::::W WWWWW W:::::W + W:::::W W:::::W W:::::W + W:::::W W:::::::W W:::::W + W:::::W W:::::::::W W:::::W + W:::::W W:::::W:::::W W:::::W + W:::::W W:::::W W:::::W W:::::W + W:::::W:::::W W:::::W:::::W + W:::::::::W W:::::::::W + W:::::::W W:::::::W + W:::::W W:::::W + W:::W W:::W + WWW WWW + +"; +} +string GetLetterX() +{ + return @" + +XXXXXXX XXXXXXX +X:::::X X:::::X +X:::::X X:::::X +X::::::X X::::::X +XXX:::::X X:::::XXX + X:::::X X:::::X + X:::::X:::::X + X:::::::::X + X:::::::::X + X:::::X:::::X + X:::::X X:::::X +XXX:::::X X:::::XXX +X::::::X X::::::X +X:::::X X:::::X +X:::::X X:::::X +XXXXXXX XXXXXXX + + "; +} +string GetLetterY() +{ + return @" + +YYYYYYY YYYYYYY +Y:::::Y Y:::::Y +Y:::::Y Y:::::Y +Y::::::Y Y::::::Y +YYY:::::Y Y:::::YYY + Y:::::Y Y:::::Y + Y:::::Y:::::Y + Y:::::::::Y + Y:::::::Y + Y:::::Y + Y:::::Y + Y:::::Y + Y:::::Y + YYYY:::::YYYY + Y:::::::::::Y + YYYYYYYYYYYYY + +"; +} +string GetLetterZ() +{ + return @" + +ZZZZZZZZZZZZZZZZZZZ +Z:::::::::::::::::Z +Z:::::::::::::::::Z +Z:::ZZZZZZZZ:::::Z +ZZZZZ Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z + Z:::::Z +ZZZ:::::Z ZZZZZ +Z::::::ZZZZZZZZ:::Z +Z:::::::::::::::::Z +Z:::::::::::::::::Z +ZZZZZZZZZZZZZZZZZZZ + +"; +} + + +string GetNumber0() +{ + return @" + + 000000000 + 00:::::::::00 + 00:::::::::::::00 +0:::::::000:::::::0 +0::::::0 0::::::0 +0:::::0 0:::::0 +0:::::0 0:::::0 +0:::::0 000 0:::::0 +0:::::0 000 0:::::0 +0:::::0 0:::::0 +0:::::0 0:::::0 +0::::::0 0::::::0 +0:::::::000:::::::0 + 00:::::::::::::00 + 00:::::::::00 + 000000000 + +"; +} +string GetNumber1() +{ + return @" + + 1111111 + 1::::::1 +1:::::::1 +111:::::1 + 1::::1 + 1::::1 + 1::::1 + 1::::l + 1::::l + 1::::l + 1::::l + 1::::l +111::::::111 +1::::::::::1 +1::::::::::1 +111111111111 + +"; +} +string GetNumber2() +{ + return @" + + 222222222222222 +2:::::::::::::::22 +2::::::222222:::::2 +2222222 2:::::2 + 2:::::2 + 2:::::2 + 2222::::2 + 22222::::::22 + 22::::::::222 + 2:::::22222 +2:::::2 +2:::::2 +2:::::2 222222 +2::::::2222222:::::2 +2::::::::::::::::::2 +22222222222222222222 + +"; +} +string GetNumber3() +{ + return @" + + 333333333333333 +3:::::::::::::::33 +3::::::33333::::::3 +3333333 3:::::3 + 3:::::3 + 3:::::3 + 33333333:::::3 + 3:::::::::::3 + 33333333:::::3 + 3:::::3 + 3:::::3 + 3:::::3 +3333333 3:::::3 +3::::::33333::::::3 +3:::::::::::::::33 + 333333333333333 + +"; +} +string GetNumber4() +{ + return @" + + 444444444 + 4::::::::4 + 4:::::::::4 + 4::::44::::4 + 4::::4 4::::4 + 4::::4 4::::4 + 4::::4 4::::4 +4::::444444::::444 +4::::::::::::::::4 +4444444444:::::444 + 4::::4 + 4::::4 + 4::::4 + 44::::::44 + 4::::::::4 + 4444444444 + +"; +} +string GetNumber5() +{ + return @" + +555555555555555555 +5::::::::::::::::5 +5::::::::::::::::5 +5:::::555555555555 +5:::::5 +5:::::5 +5:::::5555555555 +5:::::::::::::::5 +555555555555:::::5 + 5:::::5 + 5:::::5 +5555555 5:::::5 +5::::::55555::::::5 + 55:::::::::::::55 + 55:::::::::55 + 555555555 + +"; +} +string GetNumber6() +{ + return @" + + 66666666 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::6 + 6::::::::66666 +6::::::::::::::66 +6::::::66666:::::6 +6:::::6 6:::::6 +6:::::6 6:::::6 +6::::::66666::::::6 + 66:::::::::::::66 + 66:::::::::66 + 666666666 + +"; +} +string GetNumber7() +{ + return @" + +77777777777777777777 +7::::::::::::::::::7 +7::::::::::::::::::7 +777777777777:::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 + 7::::::7 +77777777 + +"; +} +string GetNumber8() +{ + return @" + + 888888888 + 88:::::::::88 + 88:::::::::::::88 +8::::::88888::::::8 +8:::::8 8:::::8 +8:::::8 8:::::8 + 8:::::88888:::::8 + 8:::::::::::::8 + 8:::::88888:::::8 +8:::::8 8:::::8 +8:::::8 8:::::8 +8:::::8 8:::::8 +8::::::88888::::::8 + 88:::::::::::::88 + 88:::::::::88 + 888888888 + +"; +} +string GetNumber9() +{ + return @" + + 999999999 + 99:::::::::99 + 99:::::::::::::99 +9::::::99999::::::9 +9:::::9 9:::::9 +9:::::9 9:::::9 + 9:::::99999::::::9 + 99::::::::::::::9 + 99999::::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 9::::::9 + 99999999 + +"; +} + + + + diff --git a/Grafitti/Grafitti.csproj b/Grafitti/Grafitti.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Grafitti/Grafitti.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Grafitti/Program.cs b/Grafitti/Program.cs new file mode 100644 index 00000000..3751555c --- /dev/null +++ b/Grafitti/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/Hra_OOP/Boss.cs b/Hra_OOP/Boss.cs new file mode 100644 index 00000000..5789311a --- /dev/null +++ b/Hra_OOP/Boss.cs @@ -0,0 +1,38 @@ + +namespace Hra_OOP +{ + internal class Boss + { + private const int bossHealth = 800; + private const int minHealth2 = 0; + + private int currentHp2 = bossHealth; + private int bossDamage = 200; + private object name2; + Boss nepriatel = new Boss(); + + + public bool DealDamage(MojCharacter opponent) + { + opponent.TakeDamage(bossDamage); + return true; + } + + public void TakeDamage(int bossDamage) + { + currentHp2 -= bossDamage; + if (currentHp2 < minHealth2) currentHp2 = minHealth2; + } + + public int GetCurrentHp() + { + return currentHp2; + } + + public override bool Equals(object? obj) + { + return obj is Boss boss && + name2 == boss.name2; + } + } +} diff --git a/Hra_OOP/Hra_OOP.csproj b/Hra_OOP/Hra_OOP.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Hra_OOP/Hra_OOP.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Hra_OOP/MojCharakter.cs b/Hra_OOP/MojCharakter.cs new file mode 100644 index 00000000..3249fe5a --- /dev/null +++ b/Hra_OOP/MojCharakter.cs @@ -0,0 +1,40 @@ + + +using Hra_OOP; + +public class MojCharacter + +{ + private const int characterHealth = 500; + private const int minHealth = 0; + + private int currentHp = characterHealth; + private int characterDamage = 100; + private object name; + MojCharacter hrac = new MojCharacter(); + + + public bool DealDamage(monster opponent) + { + opponent.TakeDamage(characterDamage); + return true; + } + + + public void TakeDamage(int characterDamage) + { + currentHp -= characterDamage; + if (currentHp < minHealth) currentHp = minHealth; + } + + public int GetCurrentHp() + { + return currentHp; + } + + public override bool Equals(object? obj) + { + return obj is MojCharacter character && + name == character.name; + } +} diff --git a/Hra_OOP/Program.cs b/Hra_OOP/Program.cs new file mode 100644 index 00000000..b689a288 --- /dev/null +++ b/Hra_OOP/Program.cs @@ -0,0 +1,83 @@ + +// uvod +using Hra_OOP; + +internal class Program +{ + private static void Main(string[] args) + { + Console.WriteLine("Vitaj v mojej novej hre!"); + Console.WriteLine("Budes hrat 'Hviezdne vojny' no v mojej LEPSEJ verzii."); + Console.WriteLine("Budes bojovat proti vesmirnym lodiam a bude to priebiehat v kolach."); + Console.WriteLine("V 1. kole ta bude cakat normalna lod ale v 2. kole to bude boss."); + Console.WriteLine("Tvojou ulohou je porazit vsetky lode a dostat sa na koniec."); + Console.WriteLine("Prajem vela stastia!"); + + MojCharacter hrac = new MojCharacter(); + monster nepriatel = new monster(); + Boss boss = new Boss(); + // + + + //zvolenie si svojho charaktera a nepriatela + Console.WriteLine("Zadaj meno svojho charakteru (lode): "); + string characterName = Console.ReadLine(); + Console.WriteLine($"Takze tvoj character (lod) sa vola {characterName}."); + + + Console.WriteLine("Zadaj meno svojho nepriatela: "); + string monsterName = Console.ReadLine(); + Console.WriteLine($"Takze tvoj neporiatel sa vola {monsterName}."); + // + + + //1 arena + Console.WriteLine("Okay. Ideme na to!"); + Console.WriteLine("stlac enter pre spustenie utoku!"); + Console.ReadLine(); + + while (nepriatel.GetCurrentHp() > 0 && hrac.GetCurrentHp() > 0) + { + nepriatel.DealDamage(hrac); + Console.WriteLine($"{monsterName} zaútočil na {characterName}!"); + Console.WriteLine($"{characterName} má ešte {hrac.GetCurrentHp()} životov."); + + if (hrac.GetCurrentHp() <= 0) + { + Console.WriteLine($"Gratulujem! Porazil si {characterName}!"); + break; + } + + hrac.DealDamage(nepriatel); + Console.WriteLine($"{characterName} zaútočil na {monsterName}!"); + Console.WriteLine($"{monsterName} má ešte {nepriatel.GetCurrentHp()} životov."); + } + + + // zvolenie si bossa + Console.WriteLine("Takze ideme do finale!"); + Console.WriteLine("Najskor zadaj meno svojho bossa: "); + string bossName = Console.ReadLine(); + Console.WriteLine($"Takze tvoj boss sa vola {bossName}"); + // + + // utok boss + Console.WriteLine("Ideme na to!"); + Console.WriteLine("Stalc enter pre spustenie utoku: "); + Console.ReadLine(); + + while (boss.GetCurrentHp() > 0 && hrac.GetCurrentHp() > 0) + { + boss.DealDamage(hrac); + Console.WriteLine($"{bossName} zaútočil na {characterName}!"); + Console.WriteLine($"{characterName} má ešte {hrac.GetCurrentHp()} životov."); + + if (hrac.GetCurrentHp() <= 0) + { + Console.WriteLine($"Porazil si bossa {characterName}! Vyhral si hru!"); + break; + } + } + // + } +} diff --git a/Hra_OOP/monster1.cs b/Hra_OOP/monster1.cs new file mode 100644 index 00000000..c8482a21 --- /dev/null +++ b/Hra_OOP/monster1.cs @@ -0,0 +1,39 @@ + +using Hra_OOP; + +public class monster + +{ + private const int monsterHealth = 400; + private const int minHealth1 = 0; + + private int currentHp1 = monsterHealth; + private int monsterDamage = 50; + private object name1; + monster nepriatel = new monster(); + + + public bool DealDamage(MojCharacter opponent) + { + opponent.TakeDamage(monsterDamage); + return true; + } + + public void TakeDamage(int monsterDamage) + { + currentHp1 -= monsterDamage; + if (currentHp1 < minHealth1) currentHp1 = minHealth1; + } + + public int GetCurrentHp() + { + return currentHp1; + } + + public override bool Equals(object? obj) + { + return obj is monster monster && + name1 == monster.name1; + } +} + \ No newline at end of file diff --git a/Moje filmy/Moje filmy.csproj b/Moje filmy/Moje filmy.csproj new file mode 100644 index 00000000..b9c32044 --- /dev/null +++ b/Moje filmy/Moje filmy.csproj @@ -0,0 +1,11 @@ + + + + Exe + net8.0 + Moje_filmy + enable + enable + + + diff --git a/Moje filmy/Program.cs b/Moje filmy/Program.cs new file mode 100644 index 00000000..085dd441 --- /dev/null +++ b/Moje filmy/Program.cs @@ -0,0 +1,185 @@ + +// uvod + +Console.WriteLine("Vitaj v mojom svete filmov! "); +Console.WriteLine("Mozes si vybrat film ktory chces pozerat. "); +Console.WriteLine("Vsetky ktore tu vidi su moje oblubene. "); +// + +// ukazka co to dokaze + +Console.WriteLine("Tu mas moznosti, ktore mozes robit v mojej verzii 'kukaj to'!"); +Console.WriteLine("1 = Zoznam filmov!"); +Console.WriteLine("2 = Pridat film!"); +Console.WriteLine("3 = Vyhladat film!"); +Console.WriteLine("4 = Zmazat film!"); +Console.WriteLine("5 = Ukoncit program!"); +Console.WriteLine("Podla toho co chces urobit tak zadaj cislo od 1 - 5: "); +string program = Console.ReadLine(); +string vysledok = ""; +// + + +//opakovanie moznosti +bool koniec = false; +while (!koniec) + + +{ + // vypisanie moznosti + switch (program) + { + case "1": + ZobrazZoznamFilmov(ZoznamFilmov); + break; + + case "2": + Console.WriteLine("Zadaj nazov filmu na pridanie: "); + string novy = Console.ReadLine(); + ZoznamFilmov.Add(novy); + Console.WriteLine("Film bol pridany!"); + break; + + case "3": + string hladany = ZiskanieFilmu(); + bool najdeny = VyhladatFilm(ZoznamFilmov, hladany); + ZobrazitVysledok(hladany, najdeny); + break; + + case "4": + Console.WriteLine("Zadaj nazov filmu na vymazanie: "); + string mazany = Console.ReadLine(); + bool vymazany = VymazFilm(ZoznamFilmov, mazany); + ZobrazVysledokVymazania(mazany, vymazany); + break; + + case "5": + UkoncenieProgramu(); + break; + + } + + + + + // zoznam filmov + List ZoznamFilmov = new List(); + if (program == "1") + { + Console.WriteLine("Tu je moj zoznam! "); + Console.WriteLine("(1) = Rychlo a zbesilo! "); + Console.WriteLine("(2) = Thor! "); + Console.WriteLine("(3) = Hulk! "); + Console.WriteLine("(4) = Capiatn America! "); + Console.WriteLine("(5) = Spider man! "); + Console.WriteLine("(6) = Hobit! "); + Console.WriteLine("(7) = Zaklinac! "); + Console.WriteLine("(8) = Pan prstenov! "); + Console.WriteLine("(9) = Ocelova pest! "); + Console.WriteLine("(10) = Transformers! "); + } + // + + + // pridanie filmov do zoznmau + Console.WriteLine("Zadaj nazov filmu na pridanie: "); + string novyFilm = Console.ReadLine(); + PridatFilm.Add(novyFilm); + ZoznamFilmov.AddRange(PridatFilm); + PridatFilm.Clear(); + Console.WriteLine($"Film '{novyFilm}' bol pridany do zoznamu!"); + // + + + // hladanie filmu + string ZiskanieFilmu() + { + Console.WriteLine(" Ziskavanie filmu! "); + Console.WriteLine("Zadaj nazov filmu ktory chces pozerat!: "); + return Console.ReadLine(); + } + + bool VyhladatFilm(List filmy, string HladanyFilm) + { + return filmy.Exists(f => f.Equals(HladanyFilm, StringComparison.OrdinalIgnoreCase)); + } + + void ZobrazitVysledok(string HladanyFilm, bool najdeny) + { + if (najdeny) + { + Console.WriteLine($"Film {HladanyFilm} sa nasiel v zozname! "); + } + else + { + Console.WriteLine($"Film {HladanyFilm} sa nenasiel v zozname! "); + } + } + // + + + // vymazanie filmov + + void ZobrazZoznamFilmov(List filmy) + { + Console.WriteLine("Aktualny zoznam filmov! "); + foreach (string film in filmy) + { + Console.WriteLine($"{film}"); + } + Console.WriteLine(); + } + bool VymazFilm(List filmy, string FilmNaVymazanie) + { + string film = filmy.Find(f => f.Equals(FilmNaVymazanie, StringComparison.OrdinalIgnoreCase)); + if (film != null) + { + filmy.Remove(film); + return true; + } + else + { + return false; + } + } + void ZobrazVysledokVymazania(string FilmNaVymazanie, bool vymazany) + { + if (vymazany) + { + Console.WriteLine($"Film {FilmNaVymazanie} bol vymazany zo zoznamu! "); + } + else + { + Console.WriteLine($"Film {FilmNaVymazanie} sa nepodarilo vymazat! "); + } + } + // + + + //ukoncenie programu + void UkoncenieProgramu() + { + Console.WriteLine("Ukoncenie programu! "); + Console.WriteLine("Naozaj chces ukoncit program? (A/N): "); + string odpoved = Console.ReadLine(); + } + void UkoncienieProgramu() + { + Console.WriteLine("Naozaj chces ukoncit program? (A/N): "); + string odpoved = Console.ReadLine(); + + if (odpoved.Equals("A", StringComparison.OrdinalIgnoreCase)) + { + Console.WriteLine("Program sa ukoncuje... Dakujem za pouzitie!"); + Environment.Exit(0); + } + else + { + Console.WriteLine("Ukoncenie programu bolo zrusene. Pokracujes dalej!"); + } + } + void ZrusitUkoncenie() + { + Console.WriteLine("Ukonacenie programu bolo zrusene. pokracijes dalej! "); + } +} \ No newline at end of file diff --git a/OOP_2/Animal.cs b/OOP_2/Animal.cs new file mode 100644 index 00000000..08912976 --- /dev/null +++ b/OOP_2/Animal.cs @@ -0,0 +1,24 @@ + +namespace OOP_2_ +{ + internal class Animal + { + public bool bylinozravec = false; + public void setfood(bool SiBylinozravec) + { + bylinozravec = SiBylinozravec; + + } + public bool CanEatOtherAnimal() + { + if (bylinozravec == true) + { + return false; + } + else + { + return true; + } + } + } +} diff --git a/OOP_2/Masozravec.cs b/OOP_2/Masozravec.cs new file mode 100644 index 00000000..fdfec7f8 --- /dev/null +++ b/OOP_2/Masozravec.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OOP_2_ +{ + internal class Masozravec + { + } +} diff --git a/OOP_2/OOP_2..csproj b/OOP_2/OOP_2..csproj new file mode 100644 index 00000000..cf6c7efe --- /dev/null +++ b/OOP_2/OOP_2..csproj @@ -0,0 +1,11 @@ + + + + Exe + net8.0 + OOP_2_ + enable + enable + + + diff --git a/OOP_2/Program.cs b/OOP_2/Program.cs new file mode 100644 index 00000000..1081bfbb --- /dev/null +++ b/OOP_2/Program.cs @@ -0,0 +1,18 @@ +// trieda Animal +// 2 zvierata +// 1. bude masozrave +// 2. bude bylinozrave +// bylino zie ine zviera +// maso zie ine zviera + +using OOP_2_; + +Animal bylinozravec = new Animal(); +bylinozravec.setfood(true); +Animal masozravec = new Animal(); +masozravec.setfood(false); + +bool MozeBylinozravecJest = bylinozravec.CanEatOtherAnimal(); +bool MozeMasozravecJest = masozravec.CanEatOtherAnimal(); +Console.WriteLine($"bylinozravec {MozeBylinozravecJest}"); +Console.WriteLine($"masozravec {MozeMasozravecJest}"); \ No newline at end of file diff --git a/OOP_2/bylinozravec.cs b/OOP_2/bylinozravec.cs new file mode 100644 index 00000000..13a893ae --- /dev/null +++ b/OOP_2/bylinozravec.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OOP_2_ +{ + internal class bylinozravec + { + } +} diff --git a/OOP_3/OOP_3..csproj b/OOP_3/OOP_3..csproj new file mode 100644 index 00000000..67b8b3fa --- /dev/null +++ b/OOP_3/OOP_3..csproj @@ -0,0 +1,11 @@ + + + + Exe + net8.0 + OOP_3_ + enable + enable + + + diff --git a/OOP_3/Program.cs b/OOP_3/Program.cs new file mode 100644 index 00000000..e035dda0 --- /dev/null +++ b/OOP_3/Program.cs @@ -0,0 +1,13 @@ +// trieda student +// bude mat meno, vek +// zistite od studenta ci moze legalne pit alkohol +// nastavit jeho meno +// ked bude mat jeho meno tak co moze alebo nemkze pit alkohol + + +using OOP_3_; + +string StudentName = Console.ReadLine(); + +Student Matej = new Student(); +Matej.SetName(StudentName); diff --git a/OOP_3/Student.cs b/OOP_3/Student.cs new file mode 100644 index 00000000..74a20383 --- /dev/null +++ b/OOP_3/Student.cs @@ -0,0 +1,34 @@ + + +using OOP_3_; + +namespace OOP_3_ +{ + public class Student + { + public bool student = false; + public string Name; + + public bool CanDrinkAlcohol() + { + if (student == true) + { + return false; + } + else + { + return true; + } + } + + internal void SetName(string? studentName) + { + Name = studentName; + } + } +} + + + + + diff --git a/OOP_3/student1.cs b/OOP_3/student1.cs new file mode 100644 index 00000000..4ae3a12a --- /dev/null +++ b/OOP_3/student1.cs @@ -0,0 +1,11 @@ +// trieda student +// bude mat meno, vek +// zistite od studenta ci moze legalne pit alkohol +// nastavit jeho meno +// ked bude mat jeho meno tak co moze alebo nemkze pit alkohol + + +internal class student +{ + public static bool CanDrinkAlcohol { get; internal set; } +} \ No newline at end of file diff --git a/src/AppsLab-001-StartHere/Greetings.cs b/src/AppsLab-001-StartHere/Greetings.cs index fbe10953..f02fdb12 100644 --- a/src/AppsLab-001-StartHere/Greetings.cs +++ b/src/AppsLab-001-StartHere/Greetings.cs @@ -11,6 +11,6 @@ public class Greetings /// A string containing the greeting message. public string Hello() { - return "Hello World!"; + return "Hello AppsLab!"; } } diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 837131c2..5cb5b80d 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1 +1,3 @@ -Console.WriteLine("Hello, World!"); \ No newline at end of file +int age = 15; +string name = "Matej"; +Console.WriteLine($"My name is {name} and I am {age}"); \ No newline at end of file diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 3751555c..8675ef40 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,2 +1,18 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +int mojeCislo = 15; +string mojeSlovo = "Ahoj, svet!"; +bool mojaBoolHodnota = true; +DateTime dnesnyDatum = DateTime.Now; +float myFloat = 5.5f; +int sucet = mojeCislo + 5; +var myVar = "Toto je var string"; +const int MaxStudents = 15; + +Console.WriteLine(mojeCislo.ToString("000000")); +Console.WriteLine(mojeSlovo); +Console.WriteLine($"Súčet je: {sucet}"); +Console.WriteLine($"Dnes je: {dnesnyDatum.ToString("yyyy-MM-dd")}"); +Console.WriteLine($"Bool hodnota je: {mojaBoolHodnota}"); +Console.WriteLine(myFloat); +Console.WriteLine(myVar); +Console.WriteLine("Maximálny počet študentov v triede je: " + MaxStudents); + diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs index 3751555c..77f6d1a9 100644 --- a/src/AppsLab-006-Constants/Program.cs +++ b/src/AppsLab-006-Constants/Program.cs @@ -1,2 +1,6 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +const int MaxPoints = 100; +const int MinAgeDriversLicence = 20; +const string WelcomeMessage = "Vitajte v nasej triede"; +Console.WriteLine(MaxPoints); +Console.WriteLine(MinAgeDriversLicence); +Console.WriteLine(WelcomeMessage); diff --git a/src/AppsLab-007-Casting/Converter.cs b/src/AppsLab-007-Casting/Converter.cs index a64ce567..1ee9e308 100644 --- a/src/AppsLab-007-Casting/Converter.cs +++ b/src/AppsLab-007-Casting/Converter.cs @@ -10,7 +10,7 @@ public class Converter /// public double IntToDouble(int number) { - throw new NotImplementedException(); + return Convert.ToDouble(number); } /// @@ -18,7 +18,7 @@ public double IntToDouble(int number) /// public int DoubleToInt(double number) { - throw new NotImplementedException(); + return Convert.ToInt32(number); } /// @@ -26,7 +26,7 @@ public int DoubleToInt(double number) /// public double StringToDouble(string number) { - throw new NotImplementedException(); + return Convert.ToDouble(number); } /// @@ -34,7 +34,7 @@ public double StringToDouble(string number) /// public string DoubleToString(double number) { - throw new NotImplementedException(); + return Convert.ToString(number); } /// @@ -42,7 +42,7 @@ public string DoubleToString(double number) /// public string IntToString(int number) { - throw new NotImplementedException(); + return Convert.ToString(number); } /// @@ -50,7 +50,7 @@ public string IntToString(int number) /// public bool StringToBool(string boolValue) { - throw new NotImplementedException(); + return Convert.ToBoolean(boolValue); } /// @@ -58,6 +58,6 @@ public bool StringToBool(string boolValue) /// public string BoolToString(bool boolValue) { - throw new NotImplementedException(); + return Convert.ToString(boolValue); } } diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6f7376c9..448f4698 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -1,8 +1,17 @@ -Console.WriteLine("Ako sa voláš?"); -string? meno = Console.ReadLine(); -Console.WriteLine("Ahoj, " + meno); +Console.WriteLine("Vitaj v kalkulacke"); +Console.WriteLine("Zadaj prve cislo: "); +decimal cislo1 = decimal.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj druhe cislo: "); +decimal cislo2 = decimal.Parse(Console.ReadLine()); +Console.WriteLine("Zadaj operaciu (+,-,*,/,%):"); +string operacia = Console.ReadLine(); -Console.WriteLine("Koľko máš rokov?"); -string vstup = Console.ReadLine() ?? "0"; -int vek = int.Parse(vstup); -Console.WriteLine("Máš " + vek + " rokov."); +int vysledok = operacia switch +{ + "+" => (int)(cislo1 + cislo2), + "-" => (int)(cislo1 - cislo2), + "*" => (int)(cislo1 * cislo2), + "/" => (int)(cislo1 / cislo2), + "%" => (int)(cislo1 % cislo2), + _ => throw new Exception("Neznamy operator") +}; \ No newline at end of file diff --git a/src/AppsLab-009-Operators/Calculator.cs b/src/AppsLab-009-Operators/Calculator.cs index 981993a9..f0693029 100644 --- a/src/AppsLab-009-Operators/Calculator.cs +++ b/src/AppsLab-009-Operators/Calculator.cs @@ -10,7 +10,7 @@ public class Calculator /// public int Add(int a, int b) { - throw new NotImplementedException(); + return a + b; } /// @@ -18,7 +18,7 @@ public int Add(int a, int b) /// public int Subtract(int a, int b) { - throw new NotImplementedException(); + return a - b; } /// @@ -26,7 +26,7 @@ public int Subtract(int a, int b) /// public int Multiply(int a, int b) { - throw new NotImplementedException(); + return a * b; } /// @@ -34,7 +34,7 @@ public int Multiply(int a, int b) /// public double Divide(int a, int b) { - throw new NotImplementedException(); + return (double)a / b; } /// @@ -42,7 +42,7 @@ public double Divide(int a, int b) /// public int Remainder(int a, int b) { - throw new NotImplementedException(); + return a % b; } /// @@ -50,7 +50,7 @@ public int Remainder(int a, int b) /// public bool AreEqual(int a, int b) { - throw new NotImplementedException(); + return a == b; } /// @@ -58,7 +58,7 @@ public bool AreEqual(int a, int b) /// public bool AreNotEqual(int a, int b) { - throw new NotImplementedException(); + return a != b; } /// @@ -66,30 +66,29 @@ public bool AreNotEqual(int a, int b) /// public bool IsGreater(int a, int b) { - throw new NotImplementedException(); + return a > b; } /// /// This method returns true if the first integer is lesser than the second. /// - public bool IsLesser(int a, int b) + public bool IsLesser (int a, int b) { - throw new NotImplementedException(); + return a < b; } /// /// This method returns true if the first integer is greater than or equal to the second. /// - public bool IsGreaterOrEqual(int a, int b) + public bool IsGreaterOrEqual (int a, int b ) { - throw new NotImplementedException(); + return a >= b; } - /// /// This method returns true if the first integer is lesser than or equal to the second. /// public bool IsLesserOrEqual(int a, int b) { - throw new NotImplementedException(); + return a <= b; } } diff --git a/src/AppsLab-011-Strings/StringManipulator.cs b/src/AppsLab-011-Strings/StringManipulator.cs index f226d70d..c3ab2536 100644 --- a/src/AppsLab-011-Strings/StringManipulator.cs +++ b/src/AppsLab-011-Strings/StringManipulator.cs @@ -1,4 +1,7 @@ -namespace AppsLab_011_Strings; +using System.Reflection.Metadata.Ecma335; +using System.Security.Cryptography.X509Certificates; + +namespace AppsLab_011_Strings; /// /// Provides methods for manipulating strings. @@ -13,9 +16,8 @@ public class StringManipulator /// The concatenated string. public string AppendStrings(string first, string second) { - throw new NotImplementedException(); + return first + second; } - /// /// Converts a string to uppercase. /// @@ -23,7 +25,7 @@ public string AppendStrings(string first, string second) /// The uppercase string. public string ConvertToUpper(string input) { - throw new NotImplementedException(); + return input.ToUpper(); } /// @@ -33,7 +35,7 @@ public string ConvertToUpper(string input) /// The lowercase string. public string ConvertToLower(string input) { - throw new NotImplementedException(); + return input.ToLower(); } /// @@ -44,9 +46,8 @@ public string ConvertToLower(string input) /// True if the substring is found, false otherwise. public bool ContainsSubstring(string input, string substring) { - throw new NotImplementedException(); + return input.Contains(substring); } - /// /// Determines if a string starts with a substring. /// @@ -55,6 +56,12 @@ public bool ContainsSubstring(string input, string substring) /// True if the string starts with the substring, false otherwise. public bool StartsWithSubstring(string input, string substring) { - throw new NotImplementedException(); + return input.StartsWith(substring); + } + + + public string BezMedzier(string input) + { + return input.Train(); } } \ No newline at end of file diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs index ab689d49..2d65f702 100644 --- a/src/AppsLab-014-Switch/MovieRating.cs +++ b/src/AppsLab-014-Switch/MovieRating.cs @@ -12,6 +12,21 @@ public class MovieRating /// A string describing the specified movie rating. public string GetRatingDescription(int rating) { - throw new NotImplementedException(); + switch (rating) + { + case 1: + return "Veľmi zlý"; + case 2: + return "Zlý"; + case 3: + return "Priemerný"; + case 4: + return "Dobrý"; + case 5: + return "Výborný"; + default: + return "Neplatné hodnotenie"; + } } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/src/AppsLab-015-Arrays/ArrayProcessor.cs b/src/AppsLab-015-Arrays/ArrayProcessor.cs index 59f8d1c7..8757b91a 100644 --- a/src/AppsLab-015-Arrays/ArrayProcessor.cs +++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs @@ -1,4 +1,6 @@ -namespace AppsLab_015_Arrays; +using System.Security.Cryptography; + +namespace AppsLab_015_Arrays; /// /// Class ArrayProcessor provides methods for working with integer arrays. @@ -13,7 +15,12 @@ public class ArrayProcessor /// First element of the array, or 0 if array is empty. public int GetFirstElement(int[] numbers) { - throw new NotImplementedException(); + if (numbers.Length == 0) + { + return 0; + } + return numbers[0]; + } /// @@ -24,7 +31,12 @@ public int GetFirstElement(int[] numbers) /// Last element of the array, or 0 if array is empty. public int GetLastElement(int[] numbers) { - throw new NotImplementedException(); + if (numbers.Length == 0) + { + return 0; + } + return numbers[numbers.Length - 1]; + } /// @@ -36,7 +48,12 @@ public int GetLastElement(int[] numbers) /// Element at the specified position, or 0 if position is out of range. public int GetElementAtPosition(int[] numbers, int position) { - throw new NotImplementedException(); + if (position < 0 || position >= numbers.Length) + { + return 0; + } + return numbers[position]; + } /// @@ -46,6 +63,6 @@ public int GetElementAtPosition(int[] numbers, int position) /// Length of the array. public int GetLength(int[] numbers) { - throw new NotImplementedException(); + return numbers.Length; } } diff --git a/src/AppsLab-016-Loops/WeatherStats.cs b/src/AppsLab-016-Loops/WeatherStats.cs index 8bca9659..e3910c48 100644 --- a/src/AppsLab-016-Loops/WeatherStats.cs +++ b/src/AppsLab-016-Loops/WeatherStats.cs @@ -12,7 +12,12 @@ public class WeatherStats /// Average temperature. public double AverageTemperature(double[] temperatures) { - throw new NotImplementedException(); + double sum = 0; + foreach (double temperature in temperatures) + { + sum += temperature; + } + return sum / temperatures.Length; } /// @@ -22,7 +27,15 @@ public double AverageTemperature(double[] temperatures) /// Maximum temperature. public double MaxTemperature(double[] temperatures) { - throw new NotImplementedException(); + double maximum = double.MinValue; + foreach (double temperature in temperatures) + { + if (temperature > maximum) + { + maximum = temperature; + } + } + return maximum; } /// @@ -32,6 +45,14 @@ public double MaxTemperature(double[] temperatures) /// Minimum temperature. public double MinTemperature(double[] temperatures) { - throw new NotImplementedException(); + double minimum = double.MaxValue; + foreach (double temperature in temperatures) + { + if (temperature < minimum) + { + minimum = temperature; + } + } + return minimum; } } diff --git a/src/AppsLab-020-OOP/Monster.cs b/src/AppsLab-020-OOP/Monster.cs new file mode 100644 index 00000000..179b4ee1 --- /dev/null +++ b/src/AppsLab-020-OOP/Monster.cs @@ -0,0 +1,23 @@ + + +namespace AppsLab_020_OOP +{ + public class Monster + { + private const int maxHp = 200; + private const int minHp = 0; + + private int currentHp = maxHp; + private int MonsterDamage = 1; + + internal void TakeDamage(int MonsterDamage) + { + currentHp -= MonsterDamage; + } + public bool DealDamage(Player opponent) + { + opponent.TakeDamage(MonsterDamage); + return true; + } + } +} \ No newline at end of file diff --git a/src/AppsLab-020-OOP/Player.cs b/src/AppsLab-020-OOP/Player.cs new file mode 100644 index 00000000..48babc44 --- /dev/null +++ b/src/AppsLab-020-OOP/Player.cs @@ -0,0 +1,36 @@ + + + + + +namespace AppsLab_020_OOP +{ + public class Player + { + private const int maxHp = 100; + private const int minHp = 0; + + private string Name; + private int currentHp = maxHp; + private int PlayerDamage = 20; + private List inventory = new List(); + + + public bool DealDamage( Monster opponent) + { + opponent.TakeDamage(PlayerDamage); + return true; + } + + public void SetName(string? PlayerName) + { + Name = PlayerName; + } + + public void TakeDamage(int PlayerDamage) + { + int currnetHp = PlayerDamage; + } + } +} + diff --git a/src/AppsLab-020-OOP/Program.cs b/src/AppsLab-020-OOP/Program.cs index 3751555c..392925b7 100644 --- a/src/AppsLab-020-OOP/Program.cs +++ b/src/AppsLab-020-OOP/Program.cs @@ -1,2 +1,11 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +using AppsLab_020_OOP; + +string PlayerName = Console.ReadLine(); + +Player Matej = new Player(); +Matej.SetName(PlayerName); + +Monster monster = new Monster(); + +Matej.DealDamage(monster); +monster.DealDamage(Matej); \ No newline at end of file diff --git a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs index e9d8642c..daf6e1ba 100644 --- a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs +++ b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs @@ -20,14 +20,14 @@ public void IntToDouble_Given7_ShouldReturn7Point0() [Test] public void DoubleToInt_Given7Point8_ShouldReturn7() { - var result = converter.DoubleToInt(7.8); - Assert.That(result, Is.EqualTo(7), "DoubleToInt(7.8) should return 7"); + var result = converter.DoubleToInt(7.4); + Assert.That(result, Is.EqualTo(7), "DoubleToInt(7.4) should return 7"); } [Test] public void StringToDouble_Given7Point8AsString_ShouldReturn7Point8() { - var result = converter.StringToDouble("7.8"); + var result = converter.StringToDouble("7,8"); Assert.That(result, Is.EqualTo(7.8), "StringToDouble(\"7.8\") should return 7.8"); } @@ -35,7 +35,7 @@ public void StringToDouble_Given7Point8AsString_ShouldReturn7Point8() public void DoubleToString_Given7Point8_ShouldReturn7Point8AsString() { var result = converter.DoubleToString(7.8); - Assert.That(result, Is.EqualTo("7.8"), "DoubleToString(7.8) should return \"7.8\""); + Assert.That(result, Is.EqualTo("7,8"), "DoubleToString(7.8) should return \"7.8\""); } [Test] diff --git a/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs b/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs index a1efacac..3fe429fb 100644 --- a/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs +++ b/tests/AppsLab-011-Strings.Tests/StringManipulatorTests.cs @@ -85,4 +85,12 @@ public void StartsWithSubstring_DoesNotStartWithSubstring() var result = _stringManipulator.StartsWithSubstring("Hello World", "Goodbye"); Assert.That(result, Is.False, "The string starts with the substring when it should not."); } + [Test] + public void StirngJeBezMedzier() + { + var result = _stringManipulator.BezMedzier(" Hello World "); + Assert.That(result == " Hello World"); + } + + } } \ No newline at end of file