Add project files.

This commit is contained in:
Martin Murzsicz 2022-05-30 18:42:04 +02:00
parent 2b1b1dfe26
commit 82433c0453
3 changed files with 139 additions and 0 deletions

25
SzoftverTeszt.sln Normal file
View File

@ -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

106
SzoftverTeszt/Program.cs Normal file
View File

@ -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();
}
}
}

View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>