From 82433c0453c23bd5cb387bb4a87baad94f2e9736 Mon Sep 17 00:00:00 2001 From: Martin Murzsicz Date: Mon, 30 May 2022 18:42:04 +0200 Subject: [PATCH] Add project files. --- SzoftverTeszt.sln | 25 +++++++ SzoftverTeszt/Program.cs | 106 +++++++++++++++++++++++++++++ SzoftverTeszt/SzoftverTeszt.csproj | 8 +++ 3 files changed, 139 insertions(+) create mode 100644 SzoftverTeszt.sln create mode 100644 SzoftverTeszt/Program.cs create mode 100644 SzoftverTeszt/SzoftverTeszt.csproj diff --git a/SzoftverTeszt.sln b/SzoftverTeszt.sln new file mode 100644 index 0000000..d001eb7 --- /dev/null +++ b/SzoftverTeszt.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32413.511 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SzoftverTeszt", "SzoftverTeszt\SzoftverTeszt.csproj", "{B7055C4C-336D-4091-967A-A193E470BE6A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B7055C4C-336D-4091-967A-A193E470BE6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7055C4C-336D-4091-967A-A193E470BE6A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7055C4C-336D-4091-967A-A193E470BE6A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7055C4C-336D-4091-967A-A193E470BE6A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8116023-7595-419A-87E4-A3DDC0C56E21} + EndGlobalSection +EndGlobal diff --git a/SzoftverTeszt/Program.cs b/SzoftverTeszt/Program.cs new file mode 100644 index 0000000..e237d9f --- /dev/null +++ b/SzoftverTeszt/Program.cs @@ -0,0 +1,106 @@ +using System; +using System.IO; + +namespace SzoftverTeszt +{ + class Program + { + + static int beszam = 0; + static int veletlen = 0; + static int proba = 0; + static void Main(string[] args) + { + beker(); + ertekel(); + fajlba(); + veletlen = general(1, beszam + 1); + + Console.WriteLine("Szám: {0}",veletlen); + Console.WriteLine("Vége, nyomjon meg egy gombot"); + Console.ReadKey(); + } + + static void beker() + { + Console.WriteLine("Kérek egy számot"); + try + { + beszam = int.Parse(Console.ReadLine()); + if (beszam<=0) + { + throw new Exception("csak pozitiv szam lehet"); + } + else if (beszam<=10) + { + throw new Exception("másod hiba"); + } + } + + catch (Exception hiba) + { + Console.WriteLine("nem megfelelő szám"); + Console.WriteLine("hiba szövege {0}",hiba.Message); + } + + + } + + static void ertekel() + { + Console.WriteLine("köszönöm, a számod {0}", beszam); + } + + static int general (int min, int max) + { + Random rnd = new Random(); + veletlen = rnd.Next(min, max); + return veletlen; + } + + static void talalgat() + { + int betalal = 0; + do + { + try + { + Console.WriteLine("kérem a tipped: "); + betalal = int.Parse(Console.ReadLine()); + proba++; + + } + catch (Exception hiba) + { + Console.WriteLine("csak szám fogadható el"); + } + + if (veletlen < betalal) + { + Console.WriteLine("Az én számom kisebb."); + } + + if (veletlen > betalal) + { + Console.WriteLine("Az én számom nagyobb."); + } + + } + while (veletlen != betalal); + if (veletlen==betalal) + { + Console.WriteLine("Gratulalok ugyes vagy"); + } + } + + static void fajlba() + { + StreamWriter egyfajl = new StreamWriter("pontok.txt",true); + egyfajl.WriteLine("{0}:{1}", proba, beszam); + egyfajl.Close(); + } + + + + } +} diff --git a/SzoftverTeszt/SzoftverTeszt.csproj b/SzoftverTeszt/SzoftverTeszt.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/SzoftverTeszt/SzoftverTeszt.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + +