From cf18bc431f0c034cec6f567b0bb4e83ae0cc2255 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 10 Sep 2025 10:49:41 +0200 Subject: [PATCH 01/17] zmenil som nazov z hello world na appsLab --- src/AppsLab-001-StartHere/Greetings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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!"; } } From 2eba2780b71285e7d994ee97188cfdb6f8cb7aec Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 10 Sep 2025 11:42:19 +0200 Subject: [PATCH 02/17] Vypisal som na obrazovku vek a meno --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 837131c2..fd86bf0f 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 = 21; +string name = "Johny"; +Console.WriteLine($" My name is { name } and im { age }"); \ No newline at end of file From 6870494cbf338daae85d1dfb639ab8abe96142ad Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 1 Oct 2025 10:11:39 +0200 Subject: [PATCH 03/17] zmeny --- AppsLab.CSharp.Exercises.sln | 135 ++++++++++++--------- Projekt bool/Program.cs | 18 +++ Projekt bool/Projekt bool.csproj | 11 ++ Projekt random/Program.cs | 16 +++ Projekt random/Projekt operacie.csproj | 11 ++ src/AppsLab-008-ConsoleReadLine/Program.cs | 6 + 6 files changed, 139 insertions(+), 58 deletions(-) create mode 100644 Projekt bool/Program.cs create mode 100644 Projekt bool/Projekt bool.csproj create mode 100644 Projekt random/Program.cs create mode 100644 Projekt random/Projekt operacie.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 58bbf6b5..578be21c 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -5,98 +5,99 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{56555FB0-B513-49EF-9002-A5AF135EA090}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-001-StartHere", "src\AppsLab-001-StartHere\AppsLab-001-StartHere.csproj", "{57860CA2-0054-465E-BD1E-024FF8D81354}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-001-StartHere", "src\AppsLab-001-StartHere\AppsLab-001-StartHere.csproj", "{57860CA2-0054-465E-BD1E-024FF8D81354}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{FC89E9B9-1723-4328-B6F1-00EE62E6260F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-001-StartHere.Tests", "tests\AppsLab-001-StartHere.Tests\AppsLab-001-StartHere.Tests.csproj", "{FE64EA2A-841F-49D7-94C6-BB7E50FC972D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-001-StartHere.Tests", "tests\AppsLab-001-StartHere.Tests\AppsLab-001-StartHere.Tests.csproj", "{FE64EA2A-841F-49D7-94C6-BB7E50FC972D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-002-ConsoleWriteLine", "src\AppsLab-002-ConsoleWriteLine\AppsLab-002-ConsoleWriteLine.csproj", "{8CA6707B-A381-4131-909F-50D592953588}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-002-ConsoleWriteLine", "src\AppsLab-002-ConsoleWriteLine\AppsLab-002-ConsoleWriteLine.csproj", "{8CA6707B-A381-4131-909F-50D592953588}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-005-DataTypes", "src\AppsLab-005-DataTypes\AppsLab-005-DataTypes.csproj", "{AB306D1E-2942-4297-ACC3-2975FB8BF18F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-005-DataTypes", "src\AppsLab-005-DataTypes\AppsLab-005-DataTypes.csproj", "{AB306D1E-2942-4297-ACC3-2975FB8BF18F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-006-Constants", "src\AppsLab-006-Constants\AppsLab-006-Constants.csproj", "{F1E80A4A-241C-496D-92D6-B047A0EAF030}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-006-Constants", "src\AppsLab-006-Constants\AppsLab-006-Constants.csproj", "{F1E80A4A-241C-496D-92D6-B047A0EAF030}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-007-Casting", "src\AppsLab-007-Casting\AppsLab-007-Casting.csproj", "{AEEAB66C-8B62-4844-A721-1FA49E82FDEB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-007-Casting", "src\AppsLab-007-Casting\AppsLab-007-Casting.csproj", "{AEEAB66C-8B62-4844-A721-1FA49E82FDEB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-007-Casting.Tests", "tests\AppsLab-007-Casting.Tests\AppsLab-007-Casting.Tests.csproj", "{5B78F61E-B52C-4920-BE97-42AADFAA726F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-007-Casting.Tests", "tests\AppsLab-007-Casting.Tests\AppsLab-007-Casting.Tests.csproj", "{5B78F61E-B52C-4920-BE97-42AADFAA726F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-008-ConsoleReadLine", "src\AppsLab-008-ConsoleReadLine\AppsLab-008-ConsoleReadLine.csproj", "{5314C734-E722-4454-A772-D0F4641E1563}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-008-ConsoleReadLine", "src\AppsLab-008-ConsoleReadLine\AppsLab-008-ConsoleReadLine.csproj", "{5314C734-E722-4454-A772-D0F4641E1563}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-009-Operators", "src\AppsLab-009-Operators\AppsLab-009-Operators.csproj", "{B6030D54-19E2-40EF-8C93-17669CEC23E0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-009-Operators", "src\AppsLab-009-Operators\AppsLab-009-Operators.csproj", "{B6030D54-19E2-40EF-8C93-17669CEC23E0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-009-Operators.Tests", "tests\AppsLab-009-Operators.Tests\AppsLab-009-Operators.Tests.csproj", "{A6659FD2-5F11-432B-91B7-C64EAEAF669C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-009-Operators.Tests", "tests\AppsLab-009-Operators.Tests\AppsLab-009-Operators.Tests.csproj", "{A6659FD2-5F11-432B-91B7-C64EAEAF669C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-010-Math", "src\AppsLab-010-Math\AppsLab-010-Math.csproj", "{FD645D4C-9DC8-4603-A77B-8A4782F175F4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-010-Math", "src\AppsLab-010-Math\AppsLab-010-Math.csproj", "{FD645D4C-9DC8-4603-A77B-8A4782F175F4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-010-Math.Tests", "tests\AppsLab-010-Math.Tests\AppsLab-010-Math.Tests.csproj", "{A4527295-4BEE-4E42-8855-B0503A4515E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-010-Math.Tests", "tests\AppsLab-010-Math.Tests\AppsLab-010-Math.Tests.csproj", "{A4527295-4BEE-4E42-8855-B0503A4515E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-011-Strings", "src\AppsLab-011-Strings\AppsLab-011-Strings.csproj", "{E90B0337-37CA-401C-997C-05DD11E08FEF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-011-Strings", "src\AppsLab-011-Strings\AppsLab-011-Strings.csproj", "{E90B0337-37CA-401C-997C-05DD11E08FEF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-011-Strings.Tests", "tests\AppsLab-011-Strings.Tests\AppsLab-011-Strings.Tests.csproj", "{22097A4D-261D-4F21-8080-10B4DAAC9E01}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-011-Strings.Tests", "tests\AppsLab-011-Strings.Tests\AppsLab-011-Strings.Tests.csproj", "{22097A4D-261D-4F21-8080-10B4DAAC9E01}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-012-Boolean", "src\AppsLab-012-Boolean\AppsLab-012-Boolean.csproj", "{EE7C6CDA-F919-4078-81DB-E4BA7F7DE34A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-012-Boolean", "src\AppsLab-012-Boolean\AppsLab-012-Boolean.csproj", "{EE7C6CDA-F919-4078-81DB-E4BA7F7DE34A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-012-Boolean.Tests", "tests\AppsLab-012-Boolean.Tests\AppsLab-012-Boolean.Tests.csproj", "{E41ECA72-68B0-4B1B-8A47-39C0E5DA9B94}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-012-Boolean.Tests", "tests\AppsLab-012-Boolean.Tests\AppsLab-012-Boolean.Tests.csproj", "{E41ECA72-68B0-4B1B-8A47-39C0E5DA9B94}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-013-Conditions", "src\AppsLab-013-Conditions\AppsLab-013-Conditions.csproj", "{AD575FD0-3F7B-4CA3-B802-9430C0F61A42}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-013-Conditions", "src\AppsLab-013-Conditions\AppsLab-013-Conditions.csproj", "{AD575FD0-3F7B-4CA3-B802-9430C0F61A42}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-013-Conditions.Tests", "tests\AppsLab-013-Conditions.Tests\AppsLab-013-Conditions.Tests.csproj", "{8B9BEF41-B5E2-4B56-AA43-F83249D4E639}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-013-Conditions.Tests", "tests\AppsLab-013-Conditions.Tests\AppsLab-013-Conditions.Tests.csproj", "{8B9BEF41-B5E2-4B56-AA43-F83249D4E639}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-014-Switch", "src\AppsLab-014-Switch\AppsLab-014-Switch.csproj", "{EBA30F52-B7DA-4B32-BE4F-6914145E2447}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-014-Switch", "src\AppsLab-014-Switch\AppsLab-014-Switch.csproj", "{EBA30F52-B7DA-4B32-BE4F-6914145E2447}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-014-Switch.Tests", "tests\AppsLab-014-Switch.Tests\AppsLab-014-Switch.Tests.csproj", "{6A95C2D3-3B32-4612-A909-2F2AC223416E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-014-Switch.Tests", "tests\AppsLab-014-Switch.Tests\AppsLab-014-Switch.Tests.csproj", "{6A95C2D3-3B32-4612-A909-2F2AC223416E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-015-Arrays", "src\AppsLab-015-Arrays\AppsLab-015-Arrays.csproj", "{DA216DFF-5EC8-4F02-9D0A-3D49212D6903}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-015-Arrays", "src\AppsLab-015-Arrays\AppsLab-015-Arrays.csproj", "{DA216DFF-5EC8-4F02-9D0A-3D49212D6903}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-015-Arrays.Tests", "tests\AppsLab-015-Arrays.Tests\AppsLab-015-Arrays.Tests.csproj", "{2BBC2988-4C3C-45B7-9EA6-F47A23260F32}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-015-Arrays.Tests", "tests\AppsLab-015-Arrays.Tests\AppsLab-015-Arrays.Tests.csproj", "{2BBC2988-4C3C-45B7-9EA6-F47A23260F32}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-016-Loops", "src\AppsLab-016-Loops\AppsLab-016-Loops.csproj", "{2A373E5B-4048-4E70-99EE-2676D2DA9952}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-016-Loops", "src\AppsLab-016-Loops\AppsLab-016-Loops.csproj", "{2A373E5B-4048-4E70-99EE-2676D2DA9952}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-016-Loops.Tests", "tests\AppsLab-016-Loops.Tests\AppsLab-016-Loops.Tests.csproj", "{DB34DF8E-3B5B-44CC-9245-AD79F3198BD3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-016-Loops.Tests", "tests\AppsLab-016-Loops.Tests\AppsLab-016-Loops.Tests.csproj", "{DB34DF8E-3B5B-44CC-9245-AD79F3198BD3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-017-List", "src\AppsLab-017-List\AppsLab-017-List.csproj", "{CEAA82FA-127F-47C2-B25F-5588FB63F7D1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-017-List", "src\AppsLab-017-List\AppsLab-017-List.csproj", "{CEAA82FA-127F-47C2-B25F-5588FB63F7D1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-017-List.Tests", "tests\AppsLab-017-List.Tests\AppsLab-017-List.Tests.csproj", "{FCEEAC1F-D3CF-4C18-9CA3-2288B5DFAA14}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-017-List.Tests", "tests\AppsLab-017-List.Tests\AppsLab-017-List.Tests.csproj", "{FCEEAC1F-D3CF-4C18-9CA3-2288B5DFAA14}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-018-Methods", "src\AppsLab-018-Methods\AppsLab-018-Methods.csproj", "{571B250E-E17D-4CD6-8778-52B838EB9DA0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-018-Methods", "src\AppsLab-018-Methods\AppsLab-018-Methods.csproj", "{571B250E-E17D-4CD6-8778-52B838EB9DA0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-018-Methods.Tests", "tests\AppsLab-018-Methods.Tests\AppsLab-018-Methods.Tests.csproj", "{526B06CA-4937-44F2-97FB-E85680DD7867}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-018-Methods.Tests", "tests\AppsLab-018-Methods.Tests\AppsLab-018-Methods.Tests.csproj", "{526B06CA-4937-44F2-97FB-E85680DD7867}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-019-MethodsOverloading", "src\AppsLab-019-MethodsOverloading\AppsLab-019-MethodsOverloading.csproj", "{24D704DB-AB81-4F18-899C-910E8D45FC8B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-019-MethodsOverloading", "src\AppsLab-019-MethodsOverloading\AppsLab-019-MethodsOverloading.csproj", "{24D704DB-AB81-4F18-899C-910E8D45FC8B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-019-MethodsOverloading.Tests", "tests\AppsLab-019-MethodsOverloading.Tests\AppsLab-019-MethodsOverloading.Tests.csproj", "{05E10AD6-94B3-4761-95E4-1F19E14F36D1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-019-MethodsOverloading.Tests", "tests\AppsLab-019-MethodsOverloading.Tests\AppsLab-019-MethodsOverloading.Tests.csproj", "{05E10AD6-94B3-4761-95E4-1F19E14F36D1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-020-OOP", "src\AppsLab-020-OOP\AppsLab-020-OOP.csproj", "{8CB5085F-5996-490C-90EC-022AB4AD9CBC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-020-OOP", "src\AppsLab-020-OOP\AppsLab-020-OOP.csproj", "{8CB5085F-5996-490C-90EC-022AB4AD9CBC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-021-Interfaces", "src\AppsLab-021-Interfaces\AppsLab-021-Interfaces.csproj", "{9E3CBBE1-9A1A-4C1C-817C-28D383D18384}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-021-Interfaces", "src\AppsLab-021-Interfaces\AppsLab-021-Interfaces.csproj", "{9E3CBBE1-9A1A-4C1C-817C-28D383D18384}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-022-Files", "src\AppsLab-022-Files\AppsLab-022-Files.csproj", "{D3BFAA25-E460-4EC1-A60C-C183775DE8CC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-022-Files", "src\AppsLab-022-Files\AppsLab-022-Files.csproj", "{D3BFAA25-E460-4EC1-A60C-C183775DE8CC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-024-Events", "src\AppsLab-024-Events\AppsLab-024-Events.csproj", "{FC964C5F-0F80-4EDF-97E8-A4A20DE5492D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-024-Events", "src\AppsLab-024-Events\AppsLab-024-Events.csproj", "{FC964C5F-0F80-4EDF-97E8-A4A20DE5492D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-025-Lambda", "src\AppsLab-025-Lambda\AppsLab-025-Lambda.csproj", "{80DD908F-E015-4FD0-93AA-743A22E745EE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-025-Lambda", "src\AppsLab-025-Lambda\AppsLab-025-Lambda.csproj", "{80DD908F-E015-4FD0-93AA-743A22E745EE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-026-LINQ", "src\AppsLab-026-LINQ\AppsLab-026-LINQ.csproj", "{AE78C877-CE90-425B-BDDE-4951C6C3B577}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-026-LINQ", "src\AppsLab-026-LINQ\AppsLab-026-LINQ.csproj", "{AE78C877-CE90-425B-BDDE-4951C6C3B577}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-027-Generics", "src\AppsLab-027-Generics\AppsLab-027-Generics.csproj", "{0333D249-02A9-47AD-BDA6-5FD7ABF7F066}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-027-Generics", "src\AppsLab-027-Generics\AppsLab-027-Generics.csproj", "{0333D249-02A9-47AD-BDA6-5FD7ABF7F066}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-028-Indexers", "src\AppsLab-028-Indexers\AppsLab-028-Indexers.csproj", "{FA0DDC17-5730-4310-A421-7668B21E1CDD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-028-Indexers", "src\AppsLab-028-Indexers\AppsLab-028-Indexers.csproj", "{FA0DDC17-5730-4310-A421-7668B21E1CDD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-029-Async", "src\AppsLab-029-Async\AppsLab-029-Async.csproj", "{EC3E5278-8120-4A67-A57B-B7DE5211E12A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-029-Async", "src\AppsLab-029-Async\AppsLab-029-Async.csproj", "{EC3E5278-8120-4A67-A57B-B7DE5211E12A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-030-JSON", "src\AppsLab-030-JSON\AppsLab-030-JSON.csproj", "{4D0AE262-0F9B-4E15-B5EA-6CCB0B81FE2C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-030-JSON", "src\AppsLab-030-JSON\AppsLab-030-JSON.csproj", "{4D0AE262-0F9B-4E15-B5EA-6CCB0B81FE2C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-031-XML", "src\AppsLab-031-XML\AppsLab-031-XML.csproj", "{7BEA7878-B5BA-4480-BC56-2F7B836F64B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-031-XML", "src\AppsLab-031-XML\AppsLab-031-XML.csproj", "{7BEA7878-B5BA-4480-BC56-2F7B836F64B9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-033-NuGet", "src\AppsLab-033-NuGet\AppsLab-033-NuGet.csproj", "{38FFE1DF-4B49-40C1-9908-51860BCF2D3E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-033-NuGet", "src\AppsLab-033-NuGet\AppsLab-033-NuGet.csproj", "{38FFE1DF-4B49-40C1-9908-51860BCF2D3E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt operacie", "Projekt random\Projekt operacie.csproj", "{03B4600D-B5FD-4A19-9E23-565F95D7AEA1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt bool", "Projekt bool\Projekt bool.csproj", "{57994BC9-8640-4079-9513-00A5DF03AF33}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -226,18 +227,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 +623,33 @@ 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 + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Debug|x64.ActiveCfg = Debug|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Debug|x64.Build.0 = Debug|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Debug|x86.ActiveCfg = Debug|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Debug|x86.Build.0 = Debug|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Release|Any CPU.Build.0 = Release|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Release|x64.ActiveCfg = Release|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Release|x64.Build.0 = Release|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Release|x86.ActiveCfg = Release|Any CPU + {03B4600D-B5FD-4A19-9E23-565F95D7AEA1}.Release|x86.Build.0 = Release|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Debug|x64.ActiveCfg = Debug|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Debug|x64.Build.0 = Debug|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Debug|x86.ActiveCfg = Debug|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Debug|x86.Build.0 = Debug|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|Any CPU.Build.0 = Release|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|x64.ActiveCfg = Release|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|x64.Build.0 = Release|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|x86.ActiveCfg = Release|Any CPU + {57994BC9-8640-4079-9513-00A5DF03AF33}.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} @@ -680,4 +696,7 @@ Global {38FFE1DF-4B49-40C1-9908-51860BCF2D3E} = {56555FB0-B513-49EF-9002-A5AF135EA090} {83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3017922A-DE5D-41EB-A6A0-50634843C263} + EndGlobalSection EndGlobal diff --git a/Projekt bool/Program.cs b/Projekt bool/Program.cs new file mode 100644 index 00000000..8b41659b --- /dev/null +++ b/Projekt bool/Program.cs @@ -0,0 +1,18 @@ +// See https://aka.ms/new-console-template for more information +/*bool a = true; +int b = 74; +int c = 42; + +bool andBool1 = a && (b > c); +bool andBool2 = a && (b == c); +bool andBool3 = a && (b == c) || (c < b); */ + +bool a = true; +int b = 11; +int c = 9; +bool d = true; +int e = 11; + + +bool vysledok = ((c <= b) || !a) && (a == (e == b)); +int o = 5; diff --git a/Projekt bool/Projekt bool.csproj b/Projekt bool/Projekt bool.csproj new file mode 100644 index 00000000..59f01aac --- /dev/null +++ b/Projekt bool/Projekt bool.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Projekt_bool + enable + enable + + + diff --git a/Projekt random/Program.cs b/Projekt random/Program.cs new file mode 100644 index 00000000..baea6621 --- /dev/null +++ b/Projekt random/Program.cs @@ -0,0 +1,16 @@ +// See https://aka.ms/new-console-template for more information +int a = 5; +int b = 3; + +int sum = a + b; // 8 +int difference = a - b; // 2 +int product = a * b; // 15 +decimal division = a / (decimal)b; // 1.66666666666667 +int remainder = a % b; // 2 + +bool equality = a == b; // false +bool inequality = a != b; // true +bool greater = a > b; // true +bool lesser = a < b; // false +bool greaterEqual = a >= b; // true +bool lesserEqual = a <= b; // false diff --git a/Projekt random/Projekt operacie.csproj b/Projekt random/Projekt operacie.csproj new file mode 100644 index 00000000..a7c7e6dc --- /dev/null +++ b/Projekt random/Projekt operacie.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Projekt_random + enable + enable + + + diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index 6f7376c9..de520675 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -6,3 +6,9 @@ string vstup = Console.ReadLine() ?? "0"; int vek = int.Parse(vstup); Console.WriteLine("Máš " + vek + " rokov."); + +Console.WriteLine("Ahoj"); +string? prveCislo = Console.ReadLine(); +string? druheCislo = Console.ReadLine(); +int sucet = int.Parse(prveCislo) + int.Parse(druheCislo); +Console.WriteLine($"Sucet: {sucet}"); \ No newline at end of file From d220ace50ce0b0b12271bb2d1119d7286fac2000 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 1 Oct 2025 13:12:56 +0200 Subject: [PATCH 04/17] neviem 1.0 --- AppsLab.CSharp.Exercises.sln | 28 +++++++++++ Kalkulacka/Kalkulacka.csproj | 10 ++++ Kalkulacka/Program.cs | 35 ++++++++++++++ Projekt bool/Program.cs | 16 ++++++- Projekt if, else/Program.cs | 61 ++++++++++++++++++++++++ Projekt if, else/Projekt if, else.csproj | 11 +++++ 6 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 Kalkulacka/Kalkulacka.csproj create mode 100644 Kalkulacka/Program.cs create mode 100644 Projekt if, else/Program.cs create mode 100644 Projekt if, else/Projekt if, else.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 578be21c..04e90227 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -97,6 +97,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt operacie", "Projekt EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt bool", "Projekt bool\Projekt bool.csproj", "{57994BC9-8640-4079-9513-00A5DF03AF33}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt if, else", "Projekt if, else\Projekt if, else.csproj", "{799DC1CB-8575-451B-AAE5-8B8D0046A678}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka", "Kalkulacka\Kalkulacka.csproj", "{FAF894EB-A533-4F0D-9C84-918261A01455}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -647,6 +651,30 @@ Global {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|x64.Build.0 = Release|Any CPU {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|x86.ActiveCfg = Release|Any CPU {57994BC9-8640-4079-9513-00A5DF03AF33}.Release|x86.Build.0 = Release|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Debug|Any CPU.Build.0 = Debug|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Debug|x64.ActiveCfg = Debug|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Debug|x64.Build.0 = Debug|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Debug|x86.ActiveCfg = Debug|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Debug|x86.Build.0 = Debug|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Release|Any CPU.ActiveCfg = Release|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Release|Any CPU.Build.0 = Release|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Release|x64.ActiveCfg = Release|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Release|x64.Build.0 = Release|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Release|x86.ActiveCfg = Release|Any CPU + {799DC1CB-8575-451B-AAE5-8B8D0046A678}.Release|x86.Build.0 = Release|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Debug|x64.ActiveCfg = Debug|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Debug|x64.Build.0 = Debug|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Debug|x86.ActiveCfg = Debug|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Debug|x86.Build.0 = Debug|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|Any CPU.Build.0 = Release|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x64.ActiveCfg = Release|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x64.Build.0 = Release|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x86.ActiveCfg = Release|Any CPU + {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Kalkulacka/Kalkulacka.csproj b/Kalkulacka/Kalkulacka.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/Kalkulacka/Kalkulacka.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Kalkulacka/Program.cs b/Kalkulacka/Program.cs new file mode 100644 index 00000000..2783436c --- /dev/null +++ b/Kalkulacka/Program.cs @@ -0,0 +1,35 @@ +// See https://aka.ms/new-console-template for more information + + +Console.WriteLine("vyber si prve cislo"); +string? number1Text = Console.ReadLine(); +decimal number1 = decimal.Parse(number1Text); + +Console.WriteLine("+, -, /, *"); +string? znamienko = Console.ReadLine(); + +Console.WriteLine("vyber si druhe cislo"); +string? number2Text = Console.ReadLine(); +decimal number2 = decimal.Parse(number2Text); + + +if (znamienko == "+") +{ + decimal sucet = number1 + number2; + Console.WriteLine("Je to " + sucet); +} +else if (znamienko == "-") +{ + decimal rozdiel = number1 - number2; + Console.WriteLine("Je to " + rozdiel); +} +else if (znamienko == "*") +{ + decimal sucin = number1 * number2; + Console.WriteLine("Je to " + sucin); +} +else if (znamienko == "/") +{ + decimal podiel = number1 / number2; + Console.WriteLine("Je to " + podiel); +} \ No newline at end of file diff --git a/Projekt bool/Program.cs b/Projekt bool/Program.cs index 8b41659b..55b3fa98 100644 --- a/Projekt bool/Program.cs +++ b/Projekt bool/Program.cs @@ -7,7 +7,7 @@ bool andBool2 = a && (b == c); bool andBool3 = a && (b == c) || (c < b); */ -bool a = true; +/*bool a = true; int b = 11; int c = 9; bool d = true; @@ -15,4 +15,16 @@ bool vysledok = ((c <= b) || !a) && (a == (e == b)); -int o = 5; +int o = 5; */ + + + +bool a = false; +int b = 8; +int c = 10; +bool d = false; +int e = 11; + +bool vzsledok = (!(a && d) || (!(b < e) && !vysledok)); + +int x = 5; \ No newline at end of file diff --git a/Projekt if, else/Program.cs b/Projekt if, else/Program.cs new file mode 100644 index 00000000..45f74fc1 --- /dev/null +++ b/Projekt if, else/Program.cs @@ -0,0 +1,61 @@ +// See https://aka.ms/new-console-template for more information +/* +Console.WriteLine("Type a number 1-6"); +string s = Console.ReadLine(); +int number = int.Parse(s); + +if (number >= 1 && number <= 5) +{ + Console.WriteLine("hura mas kocku"); +} +else if( number == 6 ) +{ + Console.WriteLine("ides este raz"); +} +else +{ + Console.WriteLine("Nemas kocku :("); +} */ + + + + +//nacitam prve cislo +//nacitam operaciu(+, -, /, *) +//nacitam druhe cislo +//vykonam operaciu +//vypisem vysledok + + +Console.WriteLine("vyber si prve cislo"); +string? number1Text = Console.ReadLine(); +decimal number1 = decimal.Parse(number1Text); + +Console.WriteLine("+, -, /, *"); +string? znamienko = Console.ReadLine(); + +Console.WriteLine("vyber si druhe cislo"); +string? number2Text = Console.ReadLine(); +decimal number2 = decimal.Parse(number2Text); + + +if (znamienko == "+") +{ + decimal sucet = number1 + number2; + Console.WriteLine("Je to " + sucet); +} +else if (znamienko == "-") +{ + decimal rozdiel = number1 - number2; + Console.WriteLine("Je to " + rozdiel); +} +else if (znamienko == "*") +{ + decimal sucin = number1 * number2; + Console.WriteLine("Je to " + sucin); +} +else if (znamienko == "/") +{ + decimal podiel = number1 / number2; + Console.WriteLine("Je to " + podiel); +} diff --git a/Projekt if, else/Projekt if, else.csproj b/Projekt if, else/Projekt if, else.csproj new file mode 100644 index 00000000..3735effe --- /dev/null +++ b/Projekt if, else/Projekt if, else.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Projekt_if__else + enable + enable + + + From 21610ddec779d90ef7ee8f3f1080800756149802 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 8 Oct 2025 09:59:21 +0200 Subject: [PATCH 05/17] switch --- AppsLab.CSharp.Exercises.sln | 36 +++++++++++++++++--- Example switch/Example switch.csproj | 11 +++++++ Example switch/Program.cs | 14 ++++++++ Kalkulacka switch/Kalkulacka switch.csproj | 11 +++++++ Kalkulacka switch/Program.cs | 38 ++++++++++++++++++++++ Kalkulacka/Program.cs | 9 +++-- src/AppsLab-008-ConsoleReadLine/Program.cs | 10 +++++- 7 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 Example switch/Example switch.csproj create mode 100644 Example switch/Program.cs create mode 100644 Kalkulacka switch/Kalkulacka switch.csproj create mode 100644 Kalkulacka switch/Program.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 04e90227..a783873a 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -93,13 +93,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-033-NuGet", "src\Ap EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt operacie", "Projekt random\Projekt operacie.csproj", "{03B4600D-B5FD-4A19-9E23-565F95D7AEA1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Projekt operacie", "Projekt random\Projekt operacie.csproj", "{03B4600D-B5FD-4A19-9E23-565F95D7AEA1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt bool", "Projekt bool\Projekt bool.csproj", "{57994BC9-8640-4079-9513-00A5DF03AF33}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Projekt bool", "Projekt bool\Projekt bool.csproj", "{57994BC9-8640-4079-9513-00A5DF03AF33}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekt if, else", "Projekt if, else\Projekt if, else.csproj", "{799DC1CB-8575-451B-AAE5-8B8D0046A678}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Projekt if, else", "Projekt if, else\Projekt if, else.csproj", "{799DC1CB-8575-451B-AAE5-8B8D0046A678}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka", "Kalkulacka\Kalkulacka.csproj", "{FAF894EB-A533-4F0D-9C84-918261A01455}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kalkulacka", "Kalkulacka\Kalkulacka.csproj", "{FAF894EB-A533-4F0D-9C84-918261A01455}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka switch", "Kalkulacka switch\Kalkulacka switch.csproj", "{1C24154D-580D-4C70-B167-930EF4932B0B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example switch", "Example switch\Example switch.csproj", "{6C1921DE-7BAD-4FDF-A9E4-B14677955159}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -675,6 +679,30 @@ Global {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x64.Build.0 = Release|Any CPU {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x86.ActiveCfg = Release|Any CPU {FAF894EB-A533-4F0D-9C84-918261A01455}.Release|x86.Build.0 = Release|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Debug|x64.ActiveCfg = Debug|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Debug|x64.Build.0 = Debug|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Debug|x86.ActiveCfg = Debug|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Debug|x86.Build.0 = Debug|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Release|Any CPU.Build.0 = Release|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Release|x64.ActiveCfg = Release|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Release|x64.Build.0 = Release|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Release|x86.ActiveCfg = Release|Any CPU + {1C24154D-580D-4C70-B167-930EF4932B0B}.Release|x86.Build.0 = Release|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Debug|x64.ActiveCfg = Debug|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Debug|x64.Build.0 = Debug|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Debug|x86.ActiveCfg = Debug|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Debug|x86.Build.0 = Debug|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|Any CPU.Build.0 = Release|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x64.ActiveCfg = Release|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x64.Build.0 = Release|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x86.ActiveCfg = Release|Any CPU + {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Example switch/Example switch.csproj b/Example switch/Example switch.csproj new file mode 100644 index 00000000..1239c7f5 --- /dev/null +++ b/Example switch/Example switch.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Example_switch + enable + enable + + + diff --git a/Example switch/Program.cs b/Example switch/Program.cs new file mode 100644 index 00000000..b68d3c9a --- /dev/null +++ b/Example switch/Program.cs @@ -0,0 +1,14 @@ +// See https://aka.ms/new-console-template for more information + + + +int number = 3; + +string numberDescription = number switch +{ + 1 => "jeden", + 2 => "dva", + 3 => "tri", + _ => "nezname cislo", +}; +Console.WriteLine(numberDescription); // vypise: tri \ No newline at end of file diff --git a/Kalkulacka switch/Kalkulacka switch.csproj b/Kalkulacka switch/Kalkulacka switch.csproj new file mode 100644 index 00000000..da034c23 --- /dev/null +++ b/Kalkulacka switch/Kalkulacka switch.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Kalkulacka_switch + enable + enable + + + diff --git a/Kalkulacka switch/Program.cs b/Kalkulacka switch/Program.cs new file mode 100644 index 00000000..f22cc71c --- /dev/null +++ b/Kalkulacka switch/Program.cs @@ -0,0 +1,38 @@ +// See https://aka.ms/new-console-template for more information + +Console.WriteLine("vyber si prve cislo"); +string? number1Text = Console.ReadLine(); +decimal number1 = decimal.Parse(number1Text); + +Console.WriteLine("+, -, /, *, %"); +string? znamienko = Console.ReadLine(); + +Console.WriteLine("vyber si druhe cislo"); +string? number2Text = Console.ReadLine(); +decimal number2 = decimal.Parse(number2Text); + + + +switch (znamienko) +{ + case "+": + Console.WriteLine(number1 + number2); + break; + case "-": + Console.WriteLine(number1 - number2); + break; + case "*": + Console.WriteLine(number1 * number2); + break; + case "/": + if (number2 == 0) + { + Console.WriteLine("Chyba: nemozes delit nulou"); + break; + } + Console.WriteLine(number1 / number2); + break; + case "%": + Console.WriteLine(number1 % number2); + break; +} diff --git a/Kalkulacka/Program.cs b/Kalkulacka/Program.cs index 2783436c..c0417f25 100644 --- a/Kalkulacka/Program.cs +++ b/Kalkulacka/Program.cs @@ -5,7 +5,7 @@ string? number1Text = Console.ReadLine(); decimal number1 = decimal.Parse(number1Text); -Console.WriteLine("+, -, /, *"); +Console.WriteLine("+, -, /, *, %"); string? znamienko = Console.ReadLine(); Console.WriteLine("vyber si druhe cislo"); @@ -32,4 +32,9 @@ { decimal podiel = number1 / number2; Console.WriteLine("Je to " + podiel); -} \ No newline at end of file +} +else if (znamienko == "%") +{ + decimal idk = number1 % number2; + Console.WriteLine("Je to " + idk); +} diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs index de520675..e0455b98 100644 --- a/src/AppsLab-008-ConsoleReadLine/Program.cs +++ b/src/AppsLab-008-ConsoleReadLine/Program.cs @@ -11,4 +11,12 @@ string? prveCislo = Console.ReadLine(); string? druheCislo = Console.ReadLine(); int sucet = int.Parse(prveCislo) + int.Parse(druheCislo); -Console.WriteLine($"Sucet: {sucet}"); \ No newline at end of file +Console.WriteLine($"Sucet: {sucet}"); + + + + +int rok = 10; +int rok1 = 20; +rok = 30; +rok *= 5; \ No newline at end of file From 065850199b8b966e27ce615d18f198f1117f52aa Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 8 Oct 2025 11:10:44 +0200 Subject: [PATCH 06/17] while --- AppsLab.CSharp.Exercises.sln | 14 ++++++++++++++ IDK/IDK.csproj | 10 ++++++++++ IDK/Program.cs | 9 +++++++++ src/AppsLab-014-Switch/MovieRating.cs | 16 +++++++++++++++- 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 IDK/IDK.csproj create mode 100644 IDK/Program.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index a783873a..9f968e94 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -105,6 +105,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka switch", "Kalkul EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example switch", "Example switch\Example switch.csproj", "{6C1921DE-7BAD-4FDF-A9E4-B14677955159}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IDK", "IDK\IDK.csproj", "{BAFB0BE1-2927-473C-9995-7DF9E8DE4082}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -703,6 +705,18 @@ Global {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x64.Build.0 = Release|Any CPU {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x86.ActiveCfg = Release|Any CPU {6C1921DE-7BAD-4FDF-A9E4-B14677955159}.Release|x86.Build.0 = Release|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Debug|x64.ActiveCfg = Debug|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Debug|x64.Build.0 = Debug|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Debug|x86.ActiveCfg = Debug|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Debug|x86.Build.0 = Debug|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|Any CPU.Build.0 = Release|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x64.ActiveCfg = Release|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x64.Build.0 = Release|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x86.ActiveCfg = Release|Any CPU + {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/IDK/IDK.csproj b/IDK/IDK.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/IDK/IDK.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/IDK/Program.cs b/IDK/Program.cs new file mode 100644 index 00000000..8c4c5adb --- /dev/null +++ b/IDK/Program.cs @@ -0,0 +1,9 @@ +// See https://aka.ms/new-console-template for more information +using System.Security.Cryptography; + +int i = 1; +while (i <= 1000) +{ + Console.WriteLine(i); + i++; +} \ No newline at end of file diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs index ab689d49..fc00d359 100644 --- a/src/AppsLab-014-Switch/MovieRating.cs +++ b/src/AppsLab-014-Switch/MovieRating.cs @@ -12,6 +12,20 @@ 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 From da558c8dfa9d4e6ee26356d2b4daecfe2828d826 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 8 Oct 2025 13:12:23 +0200 Subject: [PATCH 07/17] novinky --- AppsLab.CSharp.Exercises.sln | 30 +++++++++++++++++++- IDK/Program.cs | 25 ++++++++++++---- IDK/{IDK.csproj => Vypisovanie cisel.csproj} | 0 Random/Program.cs | 27 ++++++++++++++++++ Random/Random.csproj | 10 +++++++ Tabulka/Program.cs | 20 +++++++++++++ Tabulka/Tabulka.csproj | 10 +++++++ 7 files changed, 116 insertions(+), 6 deletions(-) rename IDK/{IDK.csproj => Vypisovanie cisel.csproj} (100%) create mode 100644 Random/Program.cs create mode 100644 Random/Random.csproj create mode 100644 Tabulka/Program.cs create mode 100644 Tabulka/Tabulka.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 9f968e94..53aca240 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -105,7 +105,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka switch", "Kalkul EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example switch", "Example switch\Example switch.csproj", "{6C1921DE-7BAD-4FDF-A9E4-B14677955159}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IDK", "IDK\IDK.csproj", "{BAFB0BE1-2927-473C-9995-7DF9E8DE4082}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vypisovanie cisel", "IDK\Vypisovanie cisel.csproj", "{BAFB0BE1-2927-473C-9995-7DF9E8DE4082}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Random", "Random\Random.csproj", "{553309F6-CA3A-4C25-A207-C4E09E7FCEA8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tabulka", "Tabulka\Tabulka.csproj", "{E4478AEF-B119-4948-9797-EB60F90E9519}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -717,6 +721,30 @@ Global {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x64.Build.0 = Release|Any CPU {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x86.ActiveCfg = Release|Any CPU {BAFB0BE1-2927-473C-9995-7DF9E8DE4082}.Release|x86.Build.0 = Release|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Debug|x64.ActiveCfg = Debug|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Debug|x64.Build.0 = Debug|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Debug|x86.ActiveCfg = Debug|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Debug|x86.Build.0 = Debug|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Release|Any CPU.Build.0 = Release|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Release|x64.ActiveCfg = Release|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Release|x64.Build.0 = Release|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Release|x86.ActiveCfg = Release|Any CPU + {553309F6-CA3A-4C25-A207-C4E09E7FCEA8}.Release|x86.Build.0 = Release|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Debug|x64.ActiveCfg = Debug|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Debug|x64.Build.0 = Debug|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Debug|x86.ActiveCfg = Debug|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Debug|x86.Build.0 = Debug|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|Any CPU.Build.0 = Release|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x64.ActiveCfg = Release|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x64.Build.0 = Release|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x86.ActiveCfg = Release|Any CPU + {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/IDK/Program.cs b/IDK/Program.cs index 8c4c5adb..ba512e9f 100644 --- a/IDK/Program.cs +++ b/IDK/Program.cs @@ -1,9 +1,24 @@ // See https://aka.ms/new-console-template for more information +using System.Runtime.ExceptionServices; using System.Security.Cryptography; -int i = 1; -while (i <= 1000) + + +for (int i = 1; i <= 1000; i++) +{ + int modulo = i % 2; + if (modulo == 0) + { + Console.WriteLine(i); + } +} + + + +int u = 1; + +while (u <= 1000) { - Console.WriteLine(i); - i++; -} \ No newline at end of file + Console.WriteLine(u); + u++; +} diff --git a/IDK/IDK.csproj b/IDK/Vypisovanie cisel.csproj similarity index 100% rename from IDK/IDK.csproj rename to IDK/Vypisovanie cisel.csproj diff --git a/Random/Program.cs b/Random/Program.cs new file mode 100644 index 00000000..d9c4d036 --- /dev/null +++ b/Random/Program.cs @@ -0,0 +1,27 @@ +// See https://aka.ms/new-console-template for more information + +int[] numbers = new int[5]; +numbers[0] = 63; +numbers[1] = 64; +numbers[2] = 65; // mozes zapisat aj: int[] numbers = {63, 64, 65, 66, 67}; +numbers[3] = 66; +numbers[4] = 67; +int index = 0; + +while (index < 5) +{ + Console.WriteLine(numbers[index]); + index++; +} + + +for (int i = 0; i < 5; i++) +{ + Console.WriteLine(numbers[i]); +} + +foreach (int i in numbers) +{ + Console.WriteLine(numbers); +} + diff --git a/Random/Random.csproj b/Random/Random.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/Random/Random.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Tabulka/Program.cs b/Tabulka/Program.cs new file mode 100644 index 00000000..b6e4a668 --- /dev/null +++ b/Tabulka/Program.cs @@ -0,0 +1,20 @@ +// See https://aka.ms/new-console-template for more information + + + +int[] numbers = new int[] { 10, 300, 20, 40, 50 }; +string[] names = new string[] { "Janko", "Fero", "Jozo", "Miro", "Laco" }; + +string[,] matrix = new string[30, 5]; +matrix[0, 2] = "Janko"; +matrix[1, 2] = "Fero"; +matrix[25, 4] = "Miro"; + +for (int i = 0; i < 30; i++) +{ + for (int j = 0; j < 5; j++) + { + Console.Write(matrix[i, j] + ","); + } + Console.WriteLine(); +} \ No newline at end of file diff --git a/Tabulka/Tabulka.csproj b/Tabulka/Tabulka.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/Tabulka/Tabulka.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + From c151fdbada1e80a1a6a1b8685276e422dd7d97f8 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 15 Oct 2025 11:44:50 +0200 Subject: [PATCH 08/17] updateeeeee --- AppsLab.CSharp.Exercises.sln | 52 +++++++++++++++++-- Foreach/Foreach.csproj | 10 ++++ Foreach/Program.cs | 2 + IDK/Program.cs | 3 +- Random/Program.cs | 25 --------- Scitanie cisel/Program.cs | 10 ++++ Scitanie cisel/Scitanie cisel.csproj | 11 ++++ Tabulka/Program.cs | 18 +++++-- continue/Program.cs | 10 ++++ continue/continue.csproj | 10 ++++ .../Program.cs | 20 +++++++ ...cislo z klavesnice a z toho citanie.csproj | 11 ++++ src/AppsLab-011-Strings/StringManipulator.cs | 11 ++-- src/AppsLab-015-Arrays/ArrayProcessor.cs | 32 ++++++++++-- src/AppsLab-016-Loops/WeatherStats.cs | 31 +++++++++-- 15 files changed, 207 insertions(+), 49 deletions(-) create mode 100644 Foreach/Foreach.csproj create mode 100644 Foreach/Program.cs create mode 100644 Scitanie cisel/Program.cs create mode 100644 Scitanie cisel/Scitanie cisel.csproj create mode 100644 continue/Program.cs create mode 100644 continue/continue.csproj create mode 100644 random cislo z klavesnice a z toho citanie/Program.cs create mode 100644 random cislo z klavesnice a z toho citanie/random cislo z klavesnice a z toho citanie.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 53aca240..258e0278 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -101,15 +101,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Projekt if, else", "Projekt EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kalkulacka", "Kalkulacka\Kalkulacka.csproj", "{FAF894EB-A533-4F0D-9C84-918261A01455}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kalkulacka switch", "Kalkulacka switch\Kalkulacka switch.csproj", "{1C24154D-580D-4C70-B167-930EF4932B0B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kalkulacka switch", "Kalkulacka switch\Kalkulacka switch.csproj", "{1C24154D-580D-4C70-B167-930EF4932B0B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example switch", "Example switch\Example switch.csproj", "{6C1921DE-7BAD-4FDF-A9E4-B14677955159}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example switch", "Example switch\Example switch.csproj", "{6C1921DE-7BAD-4FDF-A9E4-B14677955159}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vypisovanie cisel", "IDK\Vypisovanie cisel.csproj", "{BAFB0BE1-2927-473C-9995-7DF9E8DE4082}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vypisovanie cisel", "IDK\Vypisovanie cisel.csproj", "{BAFB0BE1-2927-473C-9995-7DF9E8DE4082}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Random", "Random\Random.csproj", "{553309F6-CA3A-4C25-A207-C4E09E7FCEA8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Random", "Random\Random.csproj", "{553309F6-CA3A-4C25-A207-C4E09E7FCEA8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tabulka", "Tabulka\Tabulka.csproj", "{E4478AEF-B119-4948-9797-EB60F90E9519}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tabulka", "Tabulka\Tabulka.csproj", "{E4478AEF-B119-4948-9797-EB60F90E9519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scitanie cisel", "Scitanie cisel\Scitanie cisel.csproj", "{2BA67598-10B8-47DF-AE2B-C67A2E1A840A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "random cislo z klavesnice a z toho citanie", "random cislo z klavesnice a z toho citanie\random cislo z klavesnice a z toho citanie.csproj", "{19BB9718-D31C-4B93-95DF-A449A12AC6FE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "continue", "continue\continue.csproj", "{EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -745,6 +751,42 @@ Global {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x64.Build.0 = Release|Any CPU {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x86.ActiveCfg = Release|Any CPU {E4478AEF-B119-4948-9797-EB60F90E9519}.Release|x86.Build.0 = Release|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Debug|x64.ActiveCfg = Debug|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Debug|x64.Build.0 = Debug|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Debug|x86.ActiveCfg = Debug|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Debug|x86.Build.0 = Debug|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Release|Any CPU.Build.0 = Release|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Release|x64.ActiveCfg = Release|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Release|x64.Build.0 = Release|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Release|x86.ActiveCfg = Release|Any CPU + {2BA67598-10B8-47DF-AE2B-C67A2E1A840A}.Release|x86.Build.0 = Release|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Debug|x64.ActiveCfg = Debug|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Debug|x64.Build.0 = Debug|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Debug|x86.ActiveCfg = Debug|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Debug|x86.Build.0 = Debug|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Release|Any CPU.Build.0 = Release|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Release|x64.ActiveCfg = Release|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Release|x64.Build.0 = Release|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Release|x86.ActiveCfg = Release|Any CPU + {19BB9718-D31C-4B93-95DF-A449A12AC6FE}.Release|x86.Build.0 = Release|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Debug|x64.ActiveCfg = Debug|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Debug|x64.Build.0 = Debug|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Debug|x86.ActiveCfg = Debug|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Debug|x86.Build.0 = Debug|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|Any CPU.Build.0 = Release|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x64.ActiveCfg = Release|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x64.Build.0 = Release|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x86.ActiveCfg = Release|Any CPU + {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Foreach/Foreach.csproj b/Foreach/Foreach.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/Foreach/Foreach.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Foreach/Program.cs b/Foreach/Program.cs new file mode 100644 index 00000000..3751555c --- /dev/null +++ b/Foreach/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/IDK/Program.cs b/IDK/Program.cs index ba512e9f..2094e67a 100644 --- a/IDK/Program.cs +++ b/IDK/Program.cs @@ -14,7 +14,7 @@ } - +/* int u = 1; while (u <= 1000) @@ -22,3 +22,4 @@ Console.WriteLine(u); u++; } +*/ \ No newline at end of file diff --git a/Random/Program.cs b/Random/Program.cs index d9c4d036..6fddc773 100644 --- a/Random/Program.cs +++ b/Random/Program.cs @@ -1,27 +1,2 @@ // See https://aka.ms/new-console-template for more information -int[] numbers = new int[5]; -numbers[0] = 63; -numbers[1] = 64; -numbers[2] = 65; // mozes zapisat aj: int[] numbers = {63, 64, 65, 66, 67}; -numbers[3] = 66; -numbers[4] = 67; -int index = 0; - -while (index < 5) -{ - Console.WriteLine(numbers[index]); - index++; -} - - -for (int i = 0; i < 5; i++) -{ - Console.WriteLine(numbers[i]); -} - -foreach (int i in numbers) -{ - Console.WriteLine(numbers); -} - diff --git a/Scitanie cisel/Program.cs b/Scitanie cisel/Program.cs new file mode 100644 index 00000000..57144fce --- /dev/null +++ b/Scitanie cisel/Program.cs @@ -0,0 +1,10 @@ +// See https://aka.ms/new-console-template for more information + +int[] numbers = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 54 }; +int vysledok = 0; + +for (int i = 0; i < numbers.Length; i++) +{ + vysledok += numbers[i]; +} +Console.WriteLine(vysledok); \ No newline at end of file diff --git a/Scitanie cisel/Scitanie cisel.csproj b/Scitanie cisel/Scitanie cisel.csproj new file mode 100644 index 00000000..bf17020b --- /dev/null +++ b/Scitanie cisel/Scitanie cisel.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Scitanie_cisel + enable + enable + + + diff --git a/Tabulka/Program.cs b/Tabulka/Program.cs index b6e4a668..905a27ec 100644 --- a/Tabulka/Program.cs +++ b/Tabulka/Program.cs @@ -3,11 +3,18 @@ int[] numbers = new int[] { 10, 300, 20, 40, 50 }; -string[] names = new string[] { "Janko", "Fero", "Jozo", "Miro", "Laco" }; +string[] names = new string[] { "Jano", "Feri", "Jozo", "Miro", "Laco" }; -string[,] matrix = new string[30, 5]; -matrix[0, 2] = "Janko"; -matrix[1, 2] = "Fero"; +foreach (string name in names) +{ + Console.WriteLine("Ahoj " + name); +} + + + +/*string[,] matrix = new string[30, 5]; +matrix[0, 2] = "Jano"; +matrix[1, 2] = "Feri"; matrix[25, 4] = "Miro"; for (int i = 0; i < 30; i++) @@ -17,4 +24,5 @@ Console.Write(matrix[i, j] + ","); } Console.WriteLine(); -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/continue/Program.cs b/continue/Program.cs new file mode 100644 index 00000000..275efb95 --- /dev/null +++ b/continue/Program.cs @@ -0,0 +1,10 @@ +// See https://aka.ms/new-console-template for more information + +for (int i = 0; i < 10; i++) +{ + if (i == 5) + { + continue; + } + Console.WriteLine(i); +} diff --git a/continue/continue.csproj b/continue/continue.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/continue/continue.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/random cislo z klavesnice a z toho citanie/Program.cs b/random cislo z klavesnice a z toho citanie/Program.cs new file mode 100644 index 00000000..5a7d22c6 --- /dev/null +++ b/random cislo z klavesnice a z toho citanie/Program.cs @@ -0,0 +1,20 @@ +// See https://aka.ms/new-console-template for more information + +List numbers = new List(); +Console.WriteLine("Type numbers"); +string vstup =Console.ReadLine(); + +while (vstup != "+") +{ + numbers.Add(int.Parse(vstup)); + vstup = Console.ReadLine(); +} +Console.WriteLine("Vysledok scitania:"); +int sucet = 0; +foreach (int i in numbers) + { + sucet += i; + } +Console.WriteLine(sucet); + + diff --git a/random cislo z klavesnice a z toho citanie/random cislo z klavesnice a z toho citanie.csproj b/random cislo z klavesnice a z toho citanie/random cislo z klavesnice a z toho citanie.csproj new file mode 100644 index 00000000..2a0c64ea --- /dev/null +++ b/random cislo z klavesnice a z toho citanie/random cislo z klavesnice a z toho citanie.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + random_cislo_z_klavesnice_a_z_toho_citanie + enable + enable + + + diff --git a/src/AppsLab-011-Strings/StringManipulator.cs b/src/AppsLab-011-Strings/StringManipulator.cs index f226d70d..39b0d8aa 100644 --- a/src/AppsLab-011-Strings/StringManipulator.cs +++ b/src/AppsLab-011-Strings/StringManipulator.cs @@ -13,9 +13,10 @@ 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 +24,7 @@ public string AppendStrings(string first, string second) /// The uppercase string. public string ConvertToUpper(string input) { - throw new NotImplementedException(); + return input.ToUpper(); } /// @@ -33,7 +34,7 @@ public string ConvertToUpper(string input) /// The lowercase string. public string ConvertToLower(string input) { - throw new NotImplementedException(); + return input.ToLower(); } /// @@ -44,7 +45,7 @@ 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); } /// @@ -55,6 +56,6 @@ 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); } } \ No newline at end of file diff --git a/src/AppsLab-015-Arrays/ArrayProcessor.cs b/src/AppsLab-015-Arrays/ArrayProcessor.cs index 59f8d1c7..8fecf6cb 100644 --- a/src/AppsLab-015-Arrays/ArrayProcessor.cs +++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs @@ -13,7 +13,13 @@ public class ArrayProcessor /// First element of the array, or 0 if array is empty. public int GetFirstElement(int[] numbers) { - throw new NotImplementedException(); + if (numbers is null || numbers.Length == 0) + { + return 0; + + } + + return numbers[0]; } /// @@ -24,7 +30,13 @@ 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 is null || numbers.Length == 0) + { + return 0; + + } + + return numbers[numbers.Length - 1]; } /// @@ -36,7 +48,13 @@ 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 (numbers is null || numbers.Length == 0 || position >= numbers.Length) + { + return 0; + + } + + return numbers[position]; } /// @@ -46,6 +64,12 @@ public int GetElementAtPosition(int[] numbers, int position) /// Length of the array. public int GetLength(int[] numbers) { - throw new NotImplementedException(); + if (numbers is null) + { + return 0; + + } + + return numbers.Length; } } diff --git a/src/AppsLab-016-Loops/WeatherStats.cs b/src/AppsLab-016-Loops/WeatherStats.cs index 8bca9659..8367ded6 100644 --- a/src/AppsLab-016-Loops/WeatherStats.cs +++ b/src/AppsLab-016-Loops/WeatherStats.cs @@ -12,7 +12,13 @@ public class WeatherStats /// Average temperature. public double AverageTemperature(double[] temperatures) { - throw new NotImplementedException(); + double avarage = 0; + foreach (var temperature in temperatures) + { + avarage += temperature; + } + avarage /= temperatures.Length; + return avarage; } /// @@ -20,9 +26,18 @@ public double AverageTemperature(double[] temperatures) /// /// Array of temperatures. /// Maximum temperature. - public double MaxTemperature(double[] temperatures) + public static MaxTemperature(double[] temperatures) { - throw new NotImplementedException(); + { + double maximum = double.MinValue; + foreach (double temperature in temperatures) + { + if (temperature > maximum) + { + maximum = temperature; + } + } + } } /// @@ -32,6 +47,14 @@ public double MaxTemperature(double[] temperatures) /// Minimum temperature. public double MinTemperature(double[] temperatures) { - throw new NotImplementedException(); + double Maximum = double.MaxValue; + foreach (double temperature in temperatures) + { + if (temperature < Maximum) + { + Maximum = temperature; + } + } + return Maximum; } } From 16d96bda248902bab0a5110e398e8b2f882b2ba6 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 22 Oct 2025 13:07:02 +0200 Subject: [PATCH 09/17] n --- AppsLab.CSharp.Exercises.sln | 22 +- Random/{Random.csproj => Grafity.csproj} | 0 Random/Program.cs | 555 ++++++++++++++++++ .../Program.cs" | 548 +++++++++++++++++ ...ext vypisanie s in\303\275m pismom.csproj" | 11 + 5 files changed, 1132 insertions(+), 4 deletions(-) rename Random/{Random.csproj => Grafity.csproj} (100%) create mode 100644 "Text vypisanie s in\303\275m pismom/Program.cs" create mode 100644 "Text vypisanie s in\303\275m pismom/Text vypisanie s in\303\275m pismom.csproj" diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 258e0278..7b2041a0 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -107,15 +107,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example switch", "Example s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vypisovanie cisel", "IDK\Vypisovanie cisel.csproj", "{BAFB0BE1-2927-473C-9995-7DF9E8DE4082}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Random", "Random\Random.csproj", "{553309F6-CA3A-4C25-A207-C4E09E7FCEA8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grafity", "Random\Grafity.csproj", "{553309F6-CA3A-4C25-A207-C4E09E7FCEA8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tabulka", "Tabulka\Tabulka.csproj", "{E4478AEF-B119-4948-9797-EB60F90E9519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scitanie cisel", "Scitanie cisel\Scitanie cisel.csproj", "{2BA67598-10B8-47DF-AE2B-C67A2E1A840A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scitanie cisel", "Scitanie cisel\Scitanie cisel.csproj", "{2BA67598-10B8-47DF-AE2B-C67A2E1A840A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "random cislo z klavesnice a z toho citanie", "random cislo z klavesnice a z toho citanie\random cislo z klavesnice a z toho citanie.csproj", "{19BB9718-D31C-4B93-95DF-A449A12AC6FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "random cislo z klavesnice a z toho citanie", "random cislo z klavesnice a z toho citanie\random cislo z klavesnice a z toho citanie.csproj", "{19BB9718-D31C-4B93-95DF-A449A12AC6FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "continue", "continue\continue.csproj", "{EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "continue", "continue\continue.csproj", "{EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Text vypisanie s iným pismom", "Text vypisanie s iným pismom\Text vypisanie s iným pismom.csproj", "{CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -787,6 +789,18 @@ Global {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x64.Build.0 = Release|Any CPU {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x86.ActiveCfg = Release|Any CPU {EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}.Release|x86.Build.0 = Release|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Debug|x64.ActiveCfg = Debug|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Debug|x64.Build.0 = Debug|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Debug|x86.ActiveCfg = Debug|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Debug|x86.Build.0 = Debug|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|Any CPU.Build.0 = Release|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x64.ActiveCfg = Release|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x64.Build.0 = Release|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x86.ActiveCfg = Release|Any CPU + {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Random/Random.csproj b/Random/Grafity.csproj similarity index 100% rename from Random/Random.csproj rename to Random/Grafity.csproj diff --git a/Random/Program.cs b/Random/Program.cs index 6fddc773..f45dcef8 100644 --- a/Random/Program.cs +++ b/Random/Program.cs @@ -1,2 +1,557 @@ // See https://aka.ms/new-console-template for more information +int i = 0; +while (i < 100000000000000000) +{ + Console.WriteLine("Napis text"); + string input = Console.ReadLine(); + string output = ""; + + switch (input) + { + case "a": + case "A": + case "á": + case "Á": + output = GetLetterA(); + break; + case "b": + case "B": + output = GetLetterA(); + break; + case "c": + case "C": + case "č": + case "Č": + output = GetLetterC(); + break; + case "d": + case "D": + case "ď": + case "Ď": + output = GetLetterD(); + break; + case "e": + case "E": + output = GetLetterE(); + break; + case "f": + case "F": + output = GetLetterF(); + break; + case "g": + case "G": + output = GetLetterG(); + break; + case "h": + case "H": + output = GetLetterH(); + break; + case "i": + case "I": + case "í": + case "Í": + output = GetLetterI(); + break; + case "j": + case "J": + output = GetLetterJ(); + break; + case "k": + case "K": + output = GetLetterK(); + break; + case "l": + case "L": + output = GetLetterL(); + break; + case "m": + case "M": + output = GetLetterM(); + break; + case "n": + case "N": + output = GetLetterN(); + break; + case "o": + case "O": + case "ô": + case "ó": + output = GetLetterO(); + break; + case "p": + case "P": + output = GetLetterP(); + break; + case "q": + case "Q": + output = GetLetterQ(); + break; + case "r": + case "R": + output = GetLetterR(); + break; + case "s": + case "S": + case "š": + case "Š": + output = GetLetterS(); + break; + case "t": + case "T": + case "ť": + case "Ť": + output = GetLetterT(); + break; + case "u": + case "U": + case "ú": + case "Ú": + output = GetLetterU(); + break; + case "v": + case "V": + output = GetLetterV(); + break; + + case "w": + case "W": + output = GetLetterW(); + break; + + case "x": + case "X": + output = GetLetterX(); + break; + + case "y": + case "Y": + case "ý": + case "Ý": + output = GetLetterY(); + break; + + case "z": + case "Z": + case "ž": + case "Ž": + output = GetLetterZ(); + break; + case "0": + output = GetNumber0(); + break; + case "1": + output = GetNumber1(); + break; + case "2": + output = GetNumber2(); + break; + case "3": + output = GetNumber3(); + break; + case "4": + output = GetNumber4(); + break; + case "5": + output = GetNumber5(); + break; + case "6": + output = GetNumber6(); + break; + case "7": + output = GetNumber7(); + break; + case "8": + output = GetNumber8(); + break; + case "9": + output = GetNumber9(); + break; + } + + Console.WriteLine(output); + + string GetLetterA() + { + return @" +_____ +\__ \ + / __ \_ +(____ / + \/ "; + } + + + string GetLetterB() + { + return @" +___. +\_ |__ + | __ \ + | \_\ \ + |___ / + \/ "; + } + + + string GetLetterC() + { + return @" + ____ +_/ ___\ +\ \___ + \___ > + \/ "; + } + + string GetLetterD() + { + return @" + .___ + __| _/ + / __ | +/ /_/ | +\____ | + \/ "; + } + + string GetLetterE() + { + return @" + ____ +_/ __ \ +\ ___/ + \___ > + \/ "; + } + + string GetLetterF() + { + return @" + _____ +_/ ____\ +\ __\ + | | + |__| + "; + } + + string GetLetterG() + { + return @" + ____ + / ___\ + / /_/ > + \___ / +/_____/ "; + } + + + string GetLetterH() + { + return @" +.__ +| |__ +| | \ +| Y \ +|___| / + \/ "; + } + + + + string GetLetterI() + { + return @" +.__ +|__| +| | +| | +|__| + "; + } + + + string GetLetterJ() + { + return @" + __ + |__| + | | + | | +/\__| | +\______|"; + } + + string GetLetterK() + { + return @" + __ +| | __ +| |/ / +| < +|__|_ \ + \/"; + } + + string GetLetterL() + { + return @" +.__ +| | +| | +| |__ +|____/ + "; + } + + string GetLetterM() + { + return @" + _____ + / \ +| Y Y \ +|__|_| / + \/ "; + } + + string GetLetterN() + { + return @" + + ____ + / \ +| | \ +|___| / + \/ "; + } + + string GetLetterO() + { + return @" + ____ + / _ \ +( <_> ) + \____/ + "; + } + + string GetLetterP() + { + return @" +______ +\____ \ +| |_> > +| __/ +|__| "; + } + + string GetLetterQ() + { + return @" + ______ + / ____/ +< <_| | + \__ | + |__|"; + } + + string GetLetterR() + { + return @" +_______ +\_ __ \ + | | \/ + |__| + "; + } + + string GetLetterS() + { + return @" + ______ + / ___/ + \___ \ +/____ > + \/ "; + } + + string GetLetterT() + { + return @" + __ +_/ |_ +\ __\ + | | + |__| + "; + } + + string GetLetterU() + { + return @" + + __ __ +| | \ +| | / +|____/ + "; + } + + string GetLetterV() + { + return @" +___ __ +\ \/ / + \ / + \_/ + "; + } + + + string GetLetterW() + { + return @" +__ _ __ +\ \/ \/ / + \ / + \/\_/ + "; + } + + + string GetLetterX() + { + return @" +___ ___ +\ \/ / + > < +/__/\_ \ + \/"; + } + + + + + string GetLetterY() + { + return @" + ___.__. +< | | + \___ | + / ____| + \/ "; + } + + + + + string GetLetterZ() + { + return @" +________ +\___ / + / / +/_____ \ + \/"; + } + string GetNumber1() + { + return @" + ____ +/_ | + | | + | | + |___| + "; + } + string GetNumber2() + { + return @" +________ +\_____ \ + / ____/ +/ \ +\_______ \ + \/"; + } + string GetNumber3() + { + return @" +________ +\_____ \ + _(__ < + / \ +/______ / + \/ "; + } + string GetNumber4() + { + return @" + _____ + / | | + / | |_ +/ ^ / +\____ | + |__| "; + } + string GetNumber5() + { + return @" + .________ + | ____/ + |____ \ + / \ +/______ / + \/ "; + } + string GetNumber6() + { + return @" + ________ + / _____/ +/ __ \ +\ |__\ \ + \_____ / + \/ "; + } + string GetNumber7() + { + return @" +_________ +\______ \ + / / + / / + /____/ "; + } + string GetNumber8() + { + return @" + ______ + / __ \ + > < +/ -- \ +\______ / + \/ "; + } + string GetNumber9() + { + return @" + ________ +/ __ \ +\____ / + / / + /____/ + "; + } + string GetNumber0() + { + return @" +_______ +\ _ \ +/ /_\ \ +\ \_/ \ + \_____ / + \/ "; + } +} \ No newline at end of file diff --git "a/Text vypisanie s in\303\275m pismom/Program.cs" "b/Text vypisanie s in\303\275m pismom/Program.cs" new file mode 100644 index 00000000..6bada6ac --- /dev/null +++ "b/Text vypisanie s in\303\275m pismom/Program.cs" @@ -0,0 +1,548 @@ + +Console.WriteLine("Type some text here"); +string input = Console.ReadLine(); +string output = ""; +string[,] matrix = new string[20, 120]; +int offset = 0; + +foreach (char inputLetter in input) +{ + string outLetter = GetLetter(inputLetter.ToString()); + string[] lines = outLetter.Split(Environment.NewLine); + int letterWidth = 0; + + for (int j = 0; j < lines.Length; j++) + { + string character = lines[j]; + letterWidth = Math.Max(character.Length, letterWidth); + + for (int k = 0; k < character.Length; k++) + { + matrix[j, k + offset] = character[k].ToString(); + } + } + offset += letterWidth; +} + +for (int k = 0; k < matrix.GetLength(0); k++) +{ + for (int j = 0; j < matrix.GetLength(1); j++) + { + Console.Write(matrix[k, j] ?? " "); // Use null-coalescing operator to handle null values + } + Console.WriteLine(); +} + +string GetLetter(string input) + + { + switch (input) + { + case "a": + case "A": + case "á": + case "Á": + return GetLetterA(); + case "b": + case "B": + return GetLetterB(); + case "c": + case "C": + case "č": + case "Č": + return GetLetterC(); + case "d": + case "D": + case "ď": + case "Ď": + 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": + case "í": + case "Í": + 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": + case "ô": + case "ó": + return GetLetterO(); + case "p": + case "P": + return GetLetterP(); + case "q": + case "Q": + return GetLetterQ(); + case "r": + case "R": + return GetLetterR(); + case "s": + case "S": + case "š": + case "Š": + return GetLetterS(); + case "t": + case "T": + case "ť": + case "Ť": + return GetLetterT(); + case "u": + case "U": + case "ú": + case "Ú": + return GetLetterU(); + case "v": + case "V": + return GetLetterV(); + case "w": + case "W": + return GetLetterW(); + case "x": + case "X": + return GetLetterX(); + case "y": + case "Y": + case "ý": + case "Ý": + return GetLetterY(); + case "z": + case "Z": + case "ž": + case "Ž": + 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 "Písmeno nie je podporované."; + } + } + + + string GetLetterA() + { + return @" +_____ +\__ \ + / __ \_ +(____ / + \/ "; + } + + + string GetLetterB() + { + return @" +___. +\_ |__ + | __ \ + | \_\ \ + |___ / + \/ "; + } + + + string GetLetterC() + { + return @" + ____ +_/ ___\ +\ \___ + \___ > + \/ "; + } + + string GetLetterD() + { + return @" + .___ + __| _/ + / __ | +/ /_/ | +\____ | + \/ "; + } + + string GetLetterE() + { + return @" + ____ +_/ __ \ +\ ___/ + \___ > + \/ "; + } + + string GetLetterF() + { + return @" + _____ +_/ ____\ +\ __\ + | | + |__| + "; + } + + string GetLetterG() + { + return @" + ____ + / ___\ + / /_/ > + \___ / +/_____/ "; + } + + + string GetLetterH() + { + return @" +.__ +| |__ +| | \ +| Y \ +|___| / + \/ "; + } + + + + string GetLetterI() + { + return @" +.__ +|__| +| | +| | +|__| + "; + } + + + string GetLetterJ() + { + return @" + __ + |__| + | | + | | +/\__| | +\______|"; + } + + string GetLetterK() + { + return @" + __ +| | __ +| |/ / +| < +|__|_ \ + \/"; + } + + string GetLetterL() + { + return @" +.__ +| | +| | +| |__ +|____/ + "; + } + + string GetLetterM() + { + return @" + _____ + / \ +| Y Y \ +|__|_| / + \/ "; + } + + string GetLetterN() + { + return @" + + ____ + / \ +| | \ +|___| / + \/ "; + } + + string GetLetterO() + { + return @" + ____ + / _ \ +( <_> ) + \____/ + "; + } + + string GetLetterP() + { + return @" +______ +\____ \ +| |_> > +| __/ +|__| "; + } + + string GetLetterQ() + { + return @" + ______ + / ____/ +< <_| | + \__ | + |__|"; + } + + string GetLetterR() + { + return @" +_______ +\_ __ \ + | | \/ + |__| + "; + } + + string GetLetterS() + { + return @" + ______ + / ___/ + \___ \ +/____ > + \/ "; + } + + string GetLetterT() + { + return @" + __ +_/ |_ +\ __\ + | | + |__| + "; + } + + string GetLetterU() + { + return @" + + __ __ +| | \ +| | / +|____/ + "; + } + + string GetLetterV() + { + return @" +___ __ +\ \/ / + \ / + \_/ + "; + } + + + string GetLetterW() + { + return @" +__ _ __ +\ \/ \/ / + \ / + \/\_/ + "; + } + + + string GetLetterX() + { + return @" +___ ___ +\ \/ / + > < +/__/\_ \ + \/"; + } + + + + + string GetLetterY() + { + return @" + ___.__. +< | | + \___ | + / ____| + \/ "; + } + + + + + string GetLetterZ() + { + return @" +________ +\___ / + / / +/_____ \ + \/"; + } + string GetNumber1() + { + return @" + ____ +/_ | + | | + | | + |___| + "; + } + string GetNumber2() + { + return @" +________ +\_____ \ + / ____/ +/ \ +\_______ \ + \/"; + } + string GetNumber3() + { + return @" +________ +\_____ \ + _(__ < + / \ +/______ / + \/ "; + } + string GetNumber4() + { + return @" + _____ + / | | + / | |_ +/ ^ / +\____ | + |__| "; + } + string GetNumber5() + { + return @" + .________ + | ____/ + |____ \ + / \ +/______ / + \/ "; + } + string GetNumber6() + { + return @" + ________ + / _____/ +/ __ \ +\ |__\ \ + \_____ / + \/ "; + } + string GetNumber7() + { + return @" +_________ +\______ \ + / / + / / + /____/ "; + } + string GetNumber8() + { + return @" + ______ + / __ \ + > < +/ -- \ +\______ / + \/ "; + } + string GetNumber9() + { + return @" + ________ +/ __ \ +\____ / + / / + /____/ + "; + } + string GetNumber0() + { + return @" +_______ +\ _ \ +/ /_\ \ +\ \_/ \ + \_____ / + \/ "; + } diff --git "a/Text vypisanie s in\303\275m pismom/Text vypisanie s in\303\275m pismom.csproj" "b/Text vypisanie s in\303\275m pismom/Text vypisanie s in\303\275m pismom.csproj" new file mode 100644 index 00000000..ad281a35 --- /dev/null +++ "b/Text vypisanie s in\303\275m pismom/Text vypisanie s in\303\275m pismom.csproj" @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Text_vypisanie_s_iným_pismom + enable + enable + + + From 0846c6833d26690d77a1a280a462546bf4a1691d Mon Sep 17 00:00:00 2001 From: MichalCvengros Date: Tue, 28 Oct 2025 19:47:39 +0100 Subject: [PATCH 10/17] Ukladanie veci do suboru --- AppsLab.CSharp.Exercises.sln | 14 ++++ Subor/Program.cs | 130 +++++++++++++++++++++++++++++++++++ Subor/Subor.csproj | 10 +++ 3 files changed, 154 insertions(+) create mode 100644 Subor/Program.cs create mode 100644 Subor/Subor.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 7b2041a0..235a0e2d 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -119,6 +119,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "continue", "continue\contin EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Text vypisanie s iným pismom", "Text vypisanie s iným pismom\Text vypisanie s iným pismom.csproj", "{CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subor", "Subor\Subor.csproj", "{55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -801,6 +803,18 @@ Global {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x64.Build.0 = Release|Any CPU {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x86.ActiveCfg = Release|Any CPU {CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}.Release|x86.Build.0 = Release|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Debug|x64.ActiveCfg = Debug|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Debug|x64.Build.0 = Debug|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Debug|x86.ActiveCfg = Debug|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Debug|x86.Build.0 = Debug|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|Any CPU.Build.0 = Release|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x64.ActiveCfg = Release|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x64.Build.0 = Release|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x86.ActiveCfg = Release|Any CPU + {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Subor/Program.cs b/Subor/Program.cs new file mode 100644 index 00000000..2126f199 --- /dev/null +++ b/Subor/Program.cs @@ -0,0 +1,130 @@ + + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +List Films = new List(); + + +const string FilePath = @"C:\Temp\Films.txt"; + + +if (File.Exists(FilePath)) +{ + var text = File.ReadAllText(FilePath); + var lines = text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); + Films.AddRange(lines); + Console.WriteLine($"Loaded {Films.Count} films from {FilePath}."); +} + +for (int i = 0; i < 1000000; i++) +{ + Console.WriteLine("Choose from these ones: ( AddMovies(1),FindMovie(2), ShowMovies(3), DeleteMovie(4), EndProgram(5) )"); + string Choice = Console.ReadLine(); + + if (Choice == "1") + { + AddFilm(); + } + else if (Choice == "2") + { + FindFilm(); + } + else if (Choice == "3") + { + ShowFilms(); + } + else if (Choice == "4") + { + DeleteFilm(); + } + else if (Choice == "5") + { + + var contents = string.Join(Environment.NewLine, Films); + File.WriteAllText(FilePath, contents); + Console.WriteLine($"Saved {Films.Count} films to {FilePath}."); + Console.WriteLine("You've ended the program"); + i = 1000000; + } + else + { + Console.WriteLine("Wrong choice"); + } + + string AddFilm() + { + Console.WriteLine("Write the name of the film you want to add:"); + string filmName = Console.ReadLine(); + + if (string.IsNullOrWhiteSpace(filmName)) + { + Console.WriteLine("Film name cannot be empty."); + return null; + } + + bool alreadyExists = Films.Any(f => f.Equals(filmName, StringComparison.OrdinalIgnoreCase)); + + if (alreadyExists) + { + Console.WriteLine($"\"{filmName}\" is already in the list."); + } + else + { + Films.Add(filmName); + Console.WriteLine($"\"{filmName}\" has been added."); + } + + return filmName; + } + + string FindFilm() + { + Console.WriteLine("Write the name of the film you want to find:"); + string filmName = Console.ReadLine(); + + foreach (string film in Films) + { + if (film.Equals(filmName, StringComparison.OrdinalIgnoreCase)) + { + Console.WriteLine($"The film \"{filmName}\" is in the list."); + return filmName; + } + } + + Console.WriteLine($"The film \"{filmName}\" is not in the list."); + return filmName; + } + + string ShowFilms() + { + Console.WriteLine("The films in the list are:"); + foreach (string film in Films) + { + Console.WriteLine(film); + } + return ""; + } + + string DeleteFilm() + { + Console.WriteLine("Write the name of the film you want to delete:"); + string filmName = Console.ReadLine(); + + for (int j = 0; j < Films.Count; j++) + { + if (Films[j].Equals(filmName, StringComparison.OrdinalIgnoreCase)) + { + Films.RemoveAt(j); + Console.WriteLine($"The film \"{filmName}\" has been deleted from the list."); + return filmName; + } + } + + Console.WriteLine($"The film \"{filmName}\" is not in the list."); + return filmName; + } +} diff --git a/Subor/Subor.csproj b/Subor/Subor.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Subor/Subor.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + From 9269aa4a23b1e1e2e0e663b9140d53d6afea7c18 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 5 Nov 2025 07:40:39 +0100 Subject: [PATCH 11/17] better --- Subor/Program.cs | 146 ++++++++++++++++++++++++++++++++++++++++++++- Subor/Subor.csproj | 2 +- 2 files changed, 146 insertions(+), 2 deletions(-) diff --git a/Subor/Program.cs b/Subor/Program.cs index 2126f199..f5d89dc2 100644 --- a/Subor/Program.cs +++ b/Subor/Program.cs @@ -1,6 +1,6 @@  - +/* using System; using System.Collections.Generic; using System.IO; @@ -128,3 +128,147 @@ string DeleteFilm() return filmName; } } +*/ + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +List Films = new List(); + + +const string FilePath = @"C:\Temp\Films.txt"; + + +if (File.Exists(FilePath)) +{ + var text = File.ReadAllText(FilePath); + var lines = text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); + Films.AddRange(lines); + Console.WriteLine($"Loaded {Films.Count} films from {FilePath}."); +} + +for (int i = 0; i < 1000000; i++) +{ + bool endProgram = false; + Console.WriteLine("Choose from these ones: ( AddMovies(1),FindMovie(2), ShowMovies(3), DeleteMovie(4), EndProgram(5) )"); + string Choice = Console.ReadLine(); + + if (Choice == "1") + { + AddFilm(); + } + else if (Choice == "2") + { + FindFilm(); + } + else if (Choice == "3") + { + ShowFilms(); + } + else if (Choice == "4") + { + DeleteFilm(); + } + else if (Choice == "5") + { + + var contents = string.Join(Environment.NewLine, Films); + File.WriteAllText(FilePath, contents); + Console.WriteLine($"Saved {Films.Count} films to {FilePath}."); + Console.WriteLine("You've ended the program"); + endProgram = true; + } + else + { + Console.WriteLine("Wrong choice"); + } + + string AddFilm() + { + Console.WriteLine("Write the name of the film you want to add:"); + string filmName = Console.ReadLine(); + + if (string.IsNullOrWhiteSpace(filmName)) + { + Console.WriteLine("Film name cannot be empty."); + return null; + } + + bool alreadyExists = Films.Any(f => f.Equals(filmName, StringComparison.OrdinalIgnoreCase)); + + if (alreadyExists) + { + Console.WriteLine($"\"{filmName}\" is already in the list."); + } + else + { + Films.Add(filmName); + Console.WriteLine($"\"{filmName}\" has been added."); + } + + return filmName; + } + + string FindFilm() + { + Console.WriteLine("Write the name of the film you want to find:"); + string filmName = Console.ReadLine(); + + foreach (string film in Films) + { + if (film.Equals(filmName, StringComparison.OrdinalIgnoreCase)) + { + Console.WriteLine($"The film \"{filmName}\" is in the list."); + return filmName; + } + } + + Console.WriteLine($"The film \"{filmName}\" is not in the list."); + return filmName; + } + + string ShowFilms() + { + Console.WriteLine("The films in the list are:"); + foreach (string film in Films) + { + Console.WriteLine(film); + } + return ""; + } + + string DeleteFilm() + { + Console.WriteLine("Write the name of the film you want to delete:"); + string filmName = Console.ReadLine(); + + for (int j = 0; j < Films.Count; j++) + { + if (Films[j].Equals(filmName, StringComparison.OrdinalIgnoreCase)) + { + Films.RemoveAt(j); + Console.WriteLine($"The film \"{filmName}\" has been deleted from the list."); + return filmName; + } + } + + Console.WriteLine($"The film \"{filmName}\" is not in the list."); + return filmName; + } + if (endProgram == false) + { + i = 1; + Console.WriteLine(i); + } + else if (endProgram == true) + { + i = 1000000; + } +} + + + + diff --git a/Subor/Subor.csproj b/Subor/Subor.csproj index 2150e379..780397f2 100644 --- a/Subor/Subor.csproj +++ b/Subor/Subor.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net7.0 enable enable From 7f72264f6026370cd81b2a1c0e725886a510fe07 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 5 Nov 2025 13:05:29 +0100 Subject: [PATCH 12/17] fg --- .../PasswordGenerator.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs b/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs index b48403a4..e8ad45d3 100644 --- a/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs +++ b/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs @@ -18,7 +18,7 @@ public class PasswordGenerator /// A randomly generated password. public string GeneratePassword() { - throw new NotImplementedException(); + return GeneratePassword(DefaultLength); } /// @@ -28,7 +28,14 @@ public string GeneratePassword() /// A randomly generated password. public string GeneratePassword(int length) { - throw new NotImplementedException(); + string password = ""; + for (int i = 0; i < length; i++) + { + int rondomNumber = _random.Next(27); + password = password + Alphabet[rondomNumber].ToString(); + } + + return password; } /// From 8e193754ba05af64d781191efd631eb8dabc4216 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 12 Nov 2025 13:14:30 +0100 Subject: [PATCH 13/17] njnv... --- AppsLab.CSharp.Exercises.sln | 32 +++++++++++++++-- "Kv\303\255z/Kv\303\255z.csproj" | 10 ++++++ "Kv\303\255z/Ot\303\241zky.cs" | 31 ++++++++++++++++ "Kv\303\255z/Program.cs" | 4 +++ OPP/OPP.csproj | 10 ++++++ OPP/Program.cs | 5 +++ OPP/WordReader.cs | 19 ++++++++++ Subor/Program.cs | 2 +- .../PasswordGenerator.cs | 15 +++++++- src/AppsLab-022-Files/Program.cs | 35 +++++++++++++++++-- 10 files changed, 157 insertions(+), 6 deletions(-) create mode 100644 "Kv\303\255z/Kv\303\255z.csproj" create mode 100644 "Kv\303\255z/Ot\303\241zky.cs" create mode 100644 "Kv\303\255z/Program.cs" create mode 100644 OPP/OPP.csproj create mode 100644 OPP/Program.cs create mode 100644 OPP/WordReader.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 235a0e2d..310db217 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -117,9 +117,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "random cislo z klavesnice a EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "continue", "continue\continue.csproj", "{EECD0F6C-0DDC-4F55-A803-7C1C884B1E28}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Text vypisanie s iným pismom", "Text vypisanie s iným pismom\Text vypisanie s iným pismom.csproj", "{CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Text vypisanie s iným pismom", "Text vypisanie s iným pismom\Text vypisanie s iným pismom.csproj", "{CCF89E7A-1A99-4697-9C29-B1E3B7E4B9F8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subor", "Subor\Subor.csproj", "{55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Subor", "Subor\Subor.csproj", "{55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OPP", "OPP\OPP.csproj", "{99908E7C-1991-496A-8FE9-E566491BBA7B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kvíz", "Kvíz\Kvíz.csproj", "{BE140479-FB8B-40FD-AA8F-E285AAF570D6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -815,6 +819,30 @@ Global {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x64.Build.0 = Release|Any CPU {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x86.ActiveCfg = Release|Any CPU {55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}.Release|x86.Build.0 = Release|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Debug|x64.ActiveCfg = Debug|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Debug|x64.Build.0 = Debug|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Debug|x86.ActiveCfg = Debug|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Debug|x86.Build.0 = Debug|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|Any CPU.Build.0 = Release|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x64.ActiveCfg = Release|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x64.Build.0 = Release|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x86.ActiveCfg = Release|Any CPU + {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x86.Build.0 = Release|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x64.ActiveCfg = Debug|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x64.Build.0 = Debug|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x86.ActiveCfg = Debug|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x86.Build.0 = Debug|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|Any CPU.Build.0 = Release|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x64.ActiveCfg = Release|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x64.Build.0 = Release|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x86.ActiveCfg = Release|Any CPU + {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git "a/Kv\303\255z/Kv\303\255z.csproj" "b/Kv\303\255z/Kv\303\255z.csproj" new file mode 100644 index 00000000..f02677bf --- /dev/null +++ "b/Kv\303\255z/Kv\303\255z.csproj" @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git "a/Kv\303\255z/Ot\303\241zky.cs" "b/Kv\303\255z/Ot\303\241zky.cs" new file mode 100644 index 00000000..f3e83c79 --- /dev/null +++ "b/Kv\303\255z/Ot\303\241zky.cs" @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Channels; +using System.Threading.Tasks; + +namespace Kvíz +{ + public class Otázky + { + private const string otazka = "\\\\fs1\\Data_studenti$\\2025\\cvengrosm25\\Desktop\\._\\"; + string[] otazky = { "Ktoré zviera je najrýchlejšie na súši?\n a) Gepard \n b) Lev \n c) Puma", "Čo je hlavné mesto Francúzska? \n a) Madrid \n b) Paríž \n c) Berlín", "Ktorá planéta je najbližšie k Slnku? \n a) Merkúr \n b) Venuša \n c) Zem" }; + + + + public void Otazka() + { + Console.WriteLine(otazky[0]); + + List alphabet = new List(); + string vstup = Console.ReadLine(); + string answer = ; + + + + } + + } +} + diff --git "a/Kv\303\255z/Program.cs" "b/Kv\303\255z/Program.cs" new file mode 100644 index 00000000..4c299881 --- /dev/null +++ "b/Kv\303\255z/Program.cs" @@ -0,0 +1,4 @@ +using Kvíz; + +Otázky otázky = new(); +otázky.Otazka(); \ No newline at end of file diff --git a/OPP/OPP.csproj b/OPP/OPP.csproj new file mode 100644 index 00000000..f02677bf --- /dev/null +++ b/OPP/OPP.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/OPP/Program.cs b/OPP/Program.cs new file mode 100644 index 00000000..a18321cb --- /dev/null +++ b/OPP/Program.cs @@ -0,0 +1,5 @@ +using OPP; + +WordReader wordReader = new(); +int numberOfWords = wordReader.CountWords(); +Console.WriteLine($"Počet slov: {numberOfWords}"); \ No newline at end of file diff --git a/OPP/WordReader.cs b/OPP/WordReader.cs new file mode 100644 index 00000000..a9083e78 --- /dev/null +++ b/OPP/WordReader.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OPP +{ + public class WordReader + { + private const string _fileName = "\\\\fs1\\Data_studenti$\\2025\\cvengrosm25\\Desktop\\._\\"; + public int CountWords() + { + string text = File.ReadAllText(_fileName); + string[] words = text.Split(' '); + return words.Length; + } + } +} diff --git a/Subor/Program.cs b/Subor/Program.cs index f5d89dc2..e7412e38 100644 --- a/Subor/Program.cs +++ b/Subor/Program.cs @@ -1,6 +1,6 @@  - /* + using System; using System.Collections.Generic; using System.IO; diff --git a/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs b/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs index e8ad45d3..b6b2bb30 100644 --- a/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs +++ b/src/AppsLab-019-MethodsOverloading/PasswordGenerator.cs @@ -1,3 +1,5 @@ +using System; + namespace AppsLab_019_MethodsOverloading { /// @@ -47,7 +49,18 @@ public string GeneratePassword(int length) /// A randomly generated password. public string GeneratePassword(int length, bool includeSpecialChars, bool includeNumbers) { - throw new NotImplementedException(); + string password = GeneratePassword(length); + if (includeSpecialChars) + { + int index = _random.Next(10); + password.Replace(password[length - 1], SpecialChars[index]); + } + if (includeNumbers) + { + int Index1 = _random.Next(10); + password.Replace(password[0], Numbers[Index1]); + } + return password; } } } \ No newline at end of file diff --git a/src/AppsLab-022-Files/Program.cs b/src/AppsLab-022-Files/Program.cs index 3751555c..4c0eaca2 100644 --- a/src/AppsLab-022-Files/Program.cs +++ b/src/AppsLab-022-Files/Program.cs @@ -1,2 +1,33 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +List textList = new List(); + +Console.WriteLine("Ukladanie do súboru:"); +string? nápis = Console.ReadLine(); + +string FilePath = "\\\\fs1\\Data_studenti$\\2025\\cvengrosm25\\Desktop\\._\\" + nápis; + +for (int i = 0; i < 1;) +{ + + + + Console.WriteLine("Napíš niečo... (koniec = ukončenie programu)"); + string? Text = Console.ReadLine(); + + + + if (Text == "koniec") + { + i = 1; + File.AppendAllLines(FilePath, textList); + + + } + else + { + textList.Add(Text); + + +} + + + From e54b7623a191266297772fe9cd5dd2a50bac756a Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 19 Nov 2025 12:51:52 +0100 Subject: [PATCH 14/17] =?UTF-8?q?hladanie=20=C4=8Disla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppsLab.CSharp.Exercises.sln | 28 +++++++-------- "Hladanie \304\215\303\255sla/Engine.cs" | 35 +++++++++++++++++++ .../FileProvider.cs" | 19 ++++++++++ .../Hladanie \304\215\303\255sla.csproj" | 11 ++++++ "Hladanie \304\215\303\255sla/Program.cs" | 15 ++++++++ "Hladanie \304\215\303\255sla/Randomizer.cs" | 28 +++++++++++++++ 6 files changed, 122 insertions(+), 14 deletions(-) create mode 100644 "Hladanie \304\215\303\255sla/Engine.cs" create mode 100644 "Hladanie \304\215\303\255sla/FileProvider.cs" create mode 100644 "Hladanie \304\215\303\255sla/Hladanie \304\215\303\255sla.csproj" create mode 100644 "Hladanie \304\215\303\255sla/Program.cs" create mode 100644 "Hladanie \304\215\303\255sla/Randomizer.cs" diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 310db217..95516c8b 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -121,9 +121,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Text vypisanie s iným pism EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Subor", "Subor\Subor.csproj", "{55A5C5CE-5EFB-4B74-B4BE-7FAFB1CDCD13}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OPP", "OPP\OPP.csproj", "{99908E7C-1991-496A-8FE9-E566491BBA7B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OPP", "OPP\OPP.csproj", "{99908E7C-1991-496A-8FE9-E566491BBA7B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kvíz", "Kvíz\Kvíz.csproj", "{BE140479-FB8B-40FD-AA8F-E285AAF570D6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hladanie čísla", "Hladanie čísla\Hladanie čísla.csproj", "{812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -831,18 +831,18 @@ Global {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x64.Build.0 = Release|Any CPU {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x86.ActiveCfg = Release|Any CPU {99908E7C-1991-496A-8FE9-E566491BBA7B}.Release|x86.Build.0 = Release|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x64.ActiveCfg = Debug|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x64.Build.0 = Debug|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x86.ActiveCfg = Debug|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Debug|x86.Build.0 = Debug|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|Any CPU.Build.0 = Release|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x64.ActiveCfg = Release|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x64.Build.0 = Release|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x86.ActiveCfg = Release|Any CPU - {BE140479-FB8B-40FD-AA8F-E285AAF570D6}.Release|x86.Build.0 = Release|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Debug|x64.ActiveCfg = Debug|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Debug|x64.Build.0 = Debug|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Debug|x86.ActiveCfg = Debug|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Debug|x86.Build.0 = Debug|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|Any CPU.Build.0 = Release|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x64.ActiveCfg = Release|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x64.Build.0 = Release|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x86.ActiveCfg = Release|Any CPU + {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git "a/Hladanie \304\215\303\255sla/Engine.cs" "b/Hladanie \304\215\303\255sla/Engine.cs" new file mode 100644 index 00000000..71f60de0 --- /dev/null +++ "b/Hladanie \304\215\303\255sla/Engine.cs" @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Channels; +using System.Threading.Tasks; + +namespace Hladanie_čísla +{ + internal class Engine + { + public void Do(int randomNumber) + { + Console.WriteLine("Zadaj tvoj tip:"); + string userIntput = Console.ReadLine(); + int guess = Convert.ToInt32(userIntput); + + + while (guess != randomNumber) + { + if (guess > randomNumber) + { + Console.WriteLine("Skús menšie..."); + } + else + { + Console.WriteLine("Skús väčšie..."); + } + + userIntput = Console.ReadLine(); + guess = Convert.ToInt32(userIntput); + } + } + } +} diff --git "a/Hladanie \304\215\303\255sla/FileProvider.cs" "b/Hladanie \304\215\303\255sla/FileProvider.cs" new file mode 100644 index 00000000..b57cd9ce --- /dev/null +++ "b/Hladanie \304\215\303\255sla/FileProvider.cs" @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Hladanie_čísla +{ + internal class FileProvider + { + public int LoadMaxNumber(string filename) + { + string fileContent = File.ReadAllText(filename); + int maxNumber = Convert.ToInt32(fileContent); + return maxNumber; + } + + } +} diff --git "a/Hladanie \304\215\303\255sla/Hladanie \304\215\303\255sla.csproj" "b/Hladanie \304\215\303\255sla/Hladanie \304\215\303\255sla.csproj" new file mode 100644 index 00000000..96eeed0b --- /dev/null +++ "b/Hladanie \304\215\303\255sla/Hladanie \304\215\303\255sla.csproj" @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Hladanie_čísla + enable + enable + + + diff --git "a/Hladanie \304\215\303\255sla/Program.cs" "b/Hladanie \304\215\303\255sla/Program.cs" new file mode 100644 index 00000000..cdc65c48 --- /dev/null +++ "b/Hladanie \304\215\303\255sla/Program.cs" @@ -0,0 +1,15 @@ +using Hladanie_čísla; +Engine engine = new Engine(); +Console.WriteLine("pokracuj stlacenim klavesy"); + +while (Console.ReadKey(true).Key != ConsoleKey.Escape) +{ + FileProvider myFileProvider = new FileProvider(); + int maxNumber = myFileProvider.LoadMaxNumber("C:\\Users\\cvengrosm25\\Cisla\\cislo.txt"); + Randomizer myRandomizer = new Randomizer(maxNumber); + int randomNumber = myRandomizer.Random(); + + engine.Do(randomNumber); + Console.WriteLine("Výborne zvladol si to...pokracuj stlacenim klavesy, ESC ukoncis program"); + +} \ No newline at end of file diff --git "a/Hladanie \304\215\303\255sla/Randomizer.cs" "b/Hladanie \304\215\303\255sla/Randomizer.cs" new file mode 100644 index 00000000..b09c00a0 --- /dev/null +++ "b/Hladanie \304\215\303\255sla/Randomizer.cs" @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Hladanie_čísla +{ + internal class Randomizer + { + public int MaxNumber; + private Random Rnd; + + + public Randomizer(int maxNumber) + { + Rnd = new Random(); + MaxNumber = maxNumber; + } + + public int Random() + { + Random rnd = new Random(); + int nextNumber = rnd.Next(MaxNumber); + return nextNumber; + } + } +} From b5f754aed850e5e52b3f2f332ecccdfc730b0201 Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 26 Nov 2025 11:47:07 +0100 Subject: [PATCH 15/17] Witcher Arena --- AppsLab.CSharp.Exercises.sln | 16 +++++++++- Witcher Arena/Basilisk.cs | 6 ++++ Witcher Arena/Dragon.cs | 23 ++++++++++++++ Witcher Arena/Engine.cs | 50 ++++++++++++++++++++++++++++++ Witcher Arena/Ghoul.cs | 9 ++++++ Witcher Arena/Monster.cs | 39 +++++++++++++++++++++++ Witcher Arena/Player.cs | 26 ++++++++++++++++ Witcher Arena/Program.cs | 3 ++ Witcher Arena/Witcher Arena.csproj | 11 +++++++ 9 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 Witcher Arena/Basilisk.cs create mode 100644 Witcher Arena/Dragon.cs create mode 100644 Witcher Arena/Engine.cs create mode 100644 Witcher Arena/Ghoul.cs create mode 100644 Witcher Arena/Monster.cs create mode 100644 Witcher Arena/Player.cs create mode 100644 Witcher Arena/Program.cs create mode 100644 Witcher Arena/Witcher Arena.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 95516c8b..d1dfd638 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -123,7 +123,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Subor", "Subor\Subor.csproj EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OPP", "OPP\OPP.csproj", "{99908E7C-1991-496A-8FE9-E566491BBA7B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hladanie čísla", "Hladanie čísla\Hladanie čísla.csproj", "{812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hladanie čísla", "Hladanie čísla\Hladanie čísla.csproj", "{812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Witcher Arena", "Witcher Arena\Witcher Arena.csproj", "{0CD0C10F-3195-4C06-8EE9-884D381B6181}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -843,6 +845,18 @@ Global {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x64.Build.0 = Release|Any CPU {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x86.ActiveCfg = Release|Any CPU {812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}.Release|x86.Build.0 = Release|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Debug|x64.ActiveCfg = Debug|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Debug|x64.Build.0 = Debug|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Debug|x86.ActiveCfg = Debug|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Debug|x86.Build.0 = Debug|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|Any CPU.Build.0 = Release|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x64.ActiveCfg = Release|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x64.Build.0 = Release|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x86.ActiveCfg = Release|Any CPU + {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Witcher Arena/Basilisk.cs b/Witcher Arena/Basilisk.cs new file mode 100644 index 00000000..5e989f9a --- /dev/null +++ b/Witcher Arena/Basilisk.cs @@ -0,0 +1,6 @@ +internal class Basilisk : Monster +{ + public Basilisk(int hp, int damage) : base(hp, damage) + { + } +} \ No newline at end of file diff --git a/Witcher Arena/Dragon.cs b/Witcher Arena/Dragon.cs new file mode 100644 index 00000000..5bc35e34 --- /dev/null +++ b/Witcher Arena/Dragon.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Witcher_Arena +{ + internal class Dragon : Monster + { + private const int DAMAGE_MODIFYER = 2; + + + public Dragon(int hp, int damage) : base(hp, damage * DAMAGE_MODIFYER) + { + } + + internal override void DoDamage(Player player) + { + base.DoDamage(player); + } + } +} diff --git a/Witcher Arena/Engine.cs b/Witcher Arena/Engine.cs new file mode 100644 index 00000000..647b74b6 --- /dev/null +++ b/Witcher Arena/Engine.cs @@ -0,0 +1,50 @@ +using System.Net.Security; +using Witcher_Arena; + +internal class Engine +{ + Player player = new Player(); + Monster monster = new Ghoul(50, 10); + public int DragonBreath; + + internal void Play() + { + while (player.IsAlive()) + { + TakeTurns(); + } + } + private void TakeTurns() + { + while (monster.IsAlive()) + { + player.DoDamage(monster); + monster.DoDamage(player); + } + monster = ChooseNewMonster(); + } + + private Monster ChooseNewMonster() + { + Random rnd = new Random(); + int vyber = rnd.Next(0, 3); + if (vyber == 0) + { + return new Ghoul(50, 10); + } + if (vyber == 1) + { + return new Dragon(50, 10); + } + + return new Basilisk(500, 1); + } + public void SpecialAttack(Random random, Dragon dragon) + { + + { + player.TakeDamage(DragonBreath); + } + } +} + diff --git a/Witcher Arena/Ghoul.cs b/Witcher Arena/Ghoul.cs new file mode 100644 index 00000000..6d6a9f94 --- /dev/null +++ b/Witcher Arena/Ghoul.cs @@ -0,0 +1,9 @@ +internal class Ghoul : Monster +{ + private const int HP_MODIFYER = 2; + + + public Ghoul(int hp, int damage) : base(hp / HP_MODIFYER, damage) + { + } +} diff --git a/Witcher Arena/Monster.cs b/Witcher Arena/Monster.cs new file mode 100644 index 00000000..13cc0605 --- /dev/null +++ b/Witcher Arena/Monster.cs @@ -0,0 +1,39 @@ +using System; + +internal class Monster +{ + private int _hp; + private int _damage; + private int _DragonBreath; + + public Monster(int hp, int damage) + { + _hp = hp; + _damage = damage; + _DragonBreath = damage * 3; + } + + + internal void DoDamage(Player player, Random random) + { + int randomNumber = random.Next(3); + if (randomNumber == 0) + { + player.TakeDamage(_DragonBreath); + } + else + { + player.TakeDamage(_damage); + } + } + + internal bool IsAlive() + { + return _hp > 0; + } + + internal void TakeDamage(int damage) + { + _hp -= damage; + } +} diff --git a/Witcher Arena/Player.cs b/Witcher Arena/Player.cs new file mode 100644 index 00000000..1525942d --- /dev/null +++ b/Witcher Arena/Player.cs @@ -0,0 +1,26 @@ +internal class Player +{ + private int _hp; + private int _damage; + + public Player() + { + _hp = 100; + _damage = 10; + } + + internal void DoDamage(Monster monster) + { + monster.TakeDamage(_damage); + } + + internal bool IsAlive() + { + return _hp > 0; + } + + internal void TakeDamage(int damage) + { + _hp -= damage; + } +} diff --git a/Witcher Arena/Program.cs b/Witcher Arena/Program.cs new file mode 100644 index 00000000..c2b9f487 --- /dev/null +++ b/Witcher Arena/Program.cs @@ -0,0 +1,3 @@ +Engine engine = new Engine(); +engine.Play(); + diff --git a/Witcher Arena/Witcher Arena.csproj b/Witcher Arena/Witcher Arena.csproj new file mode 100644 index 00000000..f21a91c0 --- /dev/null +++ b/Witcher Arena/Witcher Arena.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Witcher_Arena + enable + enable + + + From db408dc5a58a91b2622af703147ad2ff485d3ebe Mon Sep 17 00:00:00 2001 From: "mcvengros66@gmail.com" Date: Wed, 3 Dec 2025 11:39:12 +0100 Subject: [PATCH 16/17] fnhiwbf --- AppsLab.CSharp.Exercises.sln | 30 ++++++++++++++++++- Bubble sorce/Bubble sorce.csproj | 11 +++++++ Bubble sorce/Program.cs | 26 ++++++++++++++++ "Zoznam \305\241tudentov/Program.cs" | 2 ++ .../Zoznam \305\241tudentov.csproj" | 11 +++++++ src/AppsLab-026-LINQ/Program.cs | 27 +++++++++++++++-- src/AppsLab-026-LINQ/Student.cs | 14 +++++++++ 7 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 Bubble sorce/Bubble sorce.csproj create mode 100644 Bubble sorce/Program.cs create mode 100644 "Zoznam \305\241tudentov/Program.cs" create mode 100644 "Zoznam \305\241tudentov/Zoznam \305\241tudentov.csproj" create mode 100644 src/AppsLab-026-LINQ/Student.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index d1dfd638..af3398d7 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -125,7 +125,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OPP", "OPP\OPP.csproj", "{9 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hladanie čísla", "Hladanie čísla\Hladanie čísla.csproj", "{812CA8D0-8D5B-4BE4-A337-DF485FD6AF37}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Witcher Arena", "Witcher Arena\Witcher Arena.csproj", "{0CD0C10F-3195-4C06-8EE9-884D381B6181}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Witcher Arena", "Witcher Arena\Witcher Arena.csproj", "{0CD0C10F-3195-4C06-8EE9-884D381B6181}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bubble sorce", "Bubble sorce\Bubble sorce.csproj", "{DA516A55-DF8F-467C-8278-164CA5F23DE5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zoznam študentov", "Zoznam študentov\Zoznam študentov.csproj", "{116C2880-875B-4675-8DE0-4F981FDA824F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -857,6 +861,30 @@ Global {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x64.Build.0 = Release|Any CPU {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x86.ActiveCfg = Release|Any CPU {0CD0C10F-3195-4C06-8EE9-884D381B6181}.Release|x86.Build.0 = Release|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Debug|x64.ActiveCfg = Debug|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Debug|x64.Build.0 = Debug|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Debug|x86.ActiveCfg = Debug|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Debug|x86.Build.0 = Debug|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Release|Any CPU.Build.0 = Release|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Release|x64.ActiveCfg = Release|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Release|x64.Build.0 = Release|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Release|x86.ActiveCfg = Release|Any CPU + {DA516A55-DF8F-467C-8278-164CA5F23DE5}.Release|x86.Build.0 = Release|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Debug|x64.ActiveCfg = Debug|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Debug|x64.Build.0 = Debug|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Debug|x86.ActiveCfg = Debug|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Debug|x86.Build.0 = Debug|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|Any CPU.Build.0 = Release|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x64.ActiveCfg = Release|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x64.Build.0 = Release|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x86.ActiveCfg = Release|Any CPU + {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Bubble sorce/Bubble sorce.csproj b/Bubble sorce/Bubble sorce.csproj new file mode 100644 index 00000000..71e09732 --- /dev/null +++ b/Bubble sorce/Bubble sorce.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Bubble_sorce + enable + enable + + + diff --git a/Bubble sorce/Program.cs b/Bubble sorce/Program.cs new file mode 100644 index 00000000..33ebf616 --- /dev/null +++ b/Bubble sorce/Program.cs @@ -0,0 +1,26 @@ +int[] numbers = new int[] { 10, 100, 6, 7, 33, 68, 77 }; + + + + +for (int j = 0; j < numbers.Length; j++) +{ + for (int i = 0; i < numbers.Length - 1; i++) + { + int first = numbers[i]; + int second = numbers[i + 1]; + + if (first > second) + { + int bubble = first; + first = second; + second = bubble; + numbers[i] = first; + numbers[i + 1] = second; + } + } +} +foreach (int i in numbers) +{ + Console.WriteLine(i); +} \ No newline at end of file diff --git "a/Zoznam \305\241tudentov/Program.cs" "b/Zoznam \305\241tudentov/Program.cs" new file mode 100644 index 00000000..3751555c --- /dev/null +++ "b/Zoznam \305\241tudentov/Program.cs" @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git "a/Zoznam \305\241tudentov/Zoznam \305\241tudentov.csproj" "b/Zoznam \305\241tudentov/Zoznam \305\241tudentov.csproj" new file mode 100644 index 00000000..80234702 --- /dev/null +++ "b/Zoznam \305\241tudentov/Zoznam \305\241tudentov.csproj" @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Zoznam_študentov + enable + enable + + + diff --git a/src/AppsLab-026-LINQ/Program.cs b/src/AppsLab-026-LINQ/Program.cs index 3751555c..fff50f00 100644 --- a/src/AppsLab-026-LINQ/Program.cs +++ b/src/AppsLab-026-LINQ/Program.cs @@ -1,2 +1,25 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +using AppsLab_026_LINQ; + +List students = new List(); +students.Add(new Student { Name = "David", age = 16 }); +students.Add(new Student { Name = "Patrik", age = 15 }); +students.Add(new Student { Name = "Alex", age = 15 }); +students.Add(new Student { Name = "Michal", age = 15 }); +students.Add(new Student { Name = "Kristian", age = 16 }); +students.Add(new Student { Name = "Fabio", age = 16 }); +students.Add(new Student { Name = "Lukáš", age = 15 }); +students.Add(new Student { Name = "Michal", age = 15 }); +students.Add(new Student { Name = "Rudko", age = 16 }); +students.Add(new Student { Name = "Michal", age = 15 }); +students.Add(new Student { Name = "Matúš", age = 15 }); +students.Add(new Student { Name = "Michal", age = 15 }); +students.Add(new Student { Name = "Marek", age = 18 }); +students.Add(new Student { Name = "Matej", age = 16 }); + +var grouppedStudents = students.GroupBy(s => s.Name); + + +foreach (var grouppedStudent in grouppedStudents) +{ + Console.WriteLine($"Meno: {grouppedStudent.Key}"); +} diff --git a/src/AppsLab-026-LINQ/Student.cs b/src/AppsLab-026-LINQ/Student.cs new file mode 100644 index 00000000..e5c2c326 --- /dev/null +++ b/src/AppsLab-026-LINQ/Student.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AppsLab_026_LINQ +{ + internal class Student + { + public string Name { get; set; } + public int age { get; set; } + } +} From 2c3f612cbef1198a3fe2ae9f90c5ca8c3f98e0a1 Mon Sep 17 00:00:00 2001 From: MichalCvengros Date: Tue, 9 Dec 2025 20:33:28 +0100 Subject: [PATCH 17/17] :D --- AppsLab.CSharp.Exercises.sln | 14 +++ vykreslenie 4-uholnika/Program.cs | 5 + vykreslenie 4-uholnika/TheSystem.cs | 115 ++++++++++++++++++ .../vykreslenie 4-uholnika.csproj | 11 ++ 4 files changed, 145 insertions(+) create mode 100644 vykreslenie 4-uholnika/Program.cs create mode 100644 vykreslenie 4-uholnika/TheSystem.cs create mode 100644 vykreslenie 4-uholnika/vykreslenie 4-uholnika.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index af3398d7..ea610661 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -131,6 +131,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bubble sorce", "Bubble sorc EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zoznam študentov", "Zoznam študentov\Zoznam študentov.csproj", "{116C2880-875B-4675-8DE0-4F981FDA824F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vykreslenie 4-uholnika", "vykreslenie 4-uholnika\vykreslenie 4-uholnika.csproj", "{52C101EA-7B13-494F-B637-7B8B502076BB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -885,6 +887,18 @@ Global {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x64.Build.0 = Release|Any CPU {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x86.ActiveCfg = Release|Any CPU {116C2880-875B-4675-8DE0-4F981FDA824F}.Release|x86.Build.0 = Release|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Debug|x64.ActiveCfg = Debug|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Debug|x64.Build.0 = Debug|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Debug|x86.ActiveCfg = Debug|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Debug|x86.Build.0 = Debug|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Release|Any CPU.Build.0 = Release|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Release|x64.ActiveCfg = Release|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Release|x64.Build.0 = Release|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Release|x86.ActiveCfg = Release|Any CPU + {52C101EA-7B13-494F-B637-7B8B502076BB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/vykreslenie 4-uholnika/Program.cs b/vykreslenie 4-uholnika/Program.cs new file mode 100644 index 00000000..02eb6519 --- /dev/null +++ b/vykreslenie 4-uholnika/Program.cs @@ -0,0 +1,5 @@ +using vykreslenie_4_uholnika; + +TheSystem system = new TheSystem(); + +system.Run(); \ No newline at end of file diff --git a/vykreslenie 4-uholnika/TheSystem.cs b/vykreslenie 4-uholnika/TheSystem.cs new file mode 100644 index 00000000..8255646c --- /dev/null +++ b/vykreslenie 4-uholnika/TheSystem.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace vykreslenie_4_uholnika +{ + internal class TheSystem + { + private int x = 0; + private int y = 0; + private int hight = 0; + private int scale = 0; + public void Run() + { + UserInputPart(); + UpperPart(); + MiddlePart(); + LowerPart(); + } + + private void UpperPart() + { + Console.SetCursorPosition(x, y); + { + Console.WriteLine("╔"); + } + int i = 1; + int j = 0; + while (i < scale - 1) + { + Console.SetCursorPosition(x + i, y); + { + Console.WriteLine("═"); + } + i++; + j++; + } + Console.SetCursorPosition(x + 1 + j, y); + { + Console.WriteLine("╗"); + } + } + private void MiddlePart() + { + hight += 1; + int i = 1; + while (i < hight - 2) + { + Console.SetCursorPosition(x, y + i); + { + Console.WriteLine("║"); + } + Console.SetCursorPosition(x + scale - 1, y + i); + { + Console.WriteLine("║"); + } + i++; + } + } + private void LowerPart() + { + Console.SetCursorPosition(x - 1, y + hight - 2); + { + Console.WriteLine(" ╚"); + } + int i = 1; + int j = 0; + while (i < scale - 1) + { + Console.SetCursorPosition(x + i, y + hight - 2); + { + Console.WriteLine("═"); + } + i++; + j++; + } + Console.SetCursorPosition(x + 1 + j, y + hight - 2); + { + Console.WriteLine("╝"); + } + } + private void UserInputPart() + { + Console.WriteLine("The x?"); + x = int.Parse(Console.ReadLine()); + Console.WriteLine("The y?"); + y = int.Parse(Console.ReadLine()); + Console.WriteLine("The Scale?"); + scale = int.Parse(Console.ReadLine()); + Console.WriteLine("The Hight"); + hight = int.Parse(Console.ReadLine()); + if (scale == 1) + { + Console.WriteLine("scale can't be 1"); + ResetStuff(); + UserInputPart(); + } + if (hight == 1) + { + Console.WriteLine("hight can't be 1"); + ResetStuff(); + UserInputPart(); + } + } + private void ResetStuff() + { + x = 0; + y = 0; + scale = 0; + hight = 0; + } + } +} diff --git a/vykreslenie 4-uholnika/vykreslenie 4-uholnika.csproj b/vykreslenie 4-uholnika/vykreslenie 4-uholnika.csproj new file mode 100644 index 00000000..7151d289 --- /dev/null +++ b/vykreslenie 4-uholnika/vykreslenie 4-uholnika.csproj @@ -0,0 +1,11 @@ + + + + Exe + net8.0 + vykreslenie_4_uholnika + enable + enable + + +