Add project files.
This commit is contained in:
106
SzoftverTeszt/Program.cs
Normal file
106
SzoftverTeszt/Program.cs
Normal 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
8
SzoftverTeszt/SzoftverTeszt.csproj
Normal file
8
SzoftverTeszt/SzoftverTeszt.csproj
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user