Add project files.
This commit is contained in:
parent
85e967c9c6
commit
488c45f831
25
LottoProgram.sln
Normal file
25
LottoProgram.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31624.102
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LottoProgram", "LottoProgram\LottoProgram.csproj", "{09777B3A-E4B7-4CCE-9546-C2664D2144A0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{09777B3A-E4B7-4CCE-9546-C2664D2144A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{09777B3A-E4B7-4CCE-9546-C2664D2144A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{09777B3A-E4B7-4CCE-9546-C2664D2144A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{09777B3A-E4B7-4CCE-9546-C2664D2144A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C2321311-4599-4FCB-AFAD-AD821DC1BD6A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
8
LottoProgram/LottoProgram.csproj
Normal file
8
LottoProgram/LottoProgram.csproj
Normal file
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
19
LottoProgram/LottoSzelveny.cs
Normal file
19
LottoProgram/LottoSzelveny.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LottoProgram
|
||||
{
|
||||
class LottoSzelveny
|
||||
{
|
||||
public int tipus;
|
||||
public int[] szamok;
|
||||
|
||||
public LottoSzelveny(int t)
|
||||
{
|
||||
tipus = t;
|
||||
szamok = new int[tipus];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
69
LottoProgram/Lottozo.cs
Normal file
69
LottoProgram/Lottozo.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LottoProgram
|
||||
{
|
||||
class Lottozo
|
||||
{
|
||||
public LottoSzelveny[] szelvenyek;
|
||||
public int szelvenySzam;
|
||||
|
||||
public void bekeres()
|
||||
{
|
||||
Console.WriteLine("Üdvözlöm a lottózóban! Hány szelvényt szeretne?");
|
||||
szelvenySzam = int.Parse(Console.ReadLine());
|
||||
szelvenyek = new LottoSzelveny[szelvenySzam];
|
||||
//Console.WriteLine(szelvenyek[0]==null);
|
||||
for (int i = 0; i < szelvenySzam; i++)
|
||||
{
|
||||
int szt;
|
||||
do
|
||||
{
|
||||
Console.WriteLine("Add meg a(z) {0}. szelvény típusát (5, 6, 7)! ", i + 1);
|
||||
szt = int.Parse(Console.ReadLine());
|
||||
} while (szt < 5 || szt > 7);
|
||||
|
||||
szelvenyek[i] = new LottoSzelveny(szt);
|
||||
|
||||
Console.WriteLine("Add meg a kitöltés módját (K vagy A)! ");
|
||||
string kmod = Console.ReadLine();
|
||||
if (kmod.ToLower()=="k")
|
||||
{
|
||||
keziKitoltes(szelvenyek[i]);
|
||||
} else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void keziKitoltes(LottoSzelveny sz)
|
||||
{
|
||||
Console.WriteLine("A szelvény kitöltése kézi. {0}-s lottó",sz.tipus);
|
||||
for (int i = 0; i < sz.tipus; i++)
|
||||
{
|
||||
Console.WriteLine("Az {0}. szám",i+1);
|
||||
sz.szamok[i] = int.Parse(Console.ReadLine());
|
||||
|
||||
}
|
||||
int hatarszam = sz.tipus == 5 ? 90 : (sz.tipus == 6 ? 45 : 35);
|
||||
//egyediség és tartomány ellenőrzése
|
||||
for (int i = 0; i < sz.szamok.Length-1; i++)
|
||||
{
|
||||
for (int j = i+1; j < sz.szamok.Length; j++)
|
||||
{
|
||||
if(sz.szamok[i]<1 || sz.szamok[i] > hatarszam ||
|
||||
sz.szamok[j] < 1 || sz.szamok[j] > hatarszam ||
|
||||
sz.szamok[i] == sz.szamok[j])
|
||||
{
|
||||
throw new Exception("Hibás számok a kézi kitöltésben!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
16
LottoProgram/Program.cs
Normal file
16
LottoProgram/Program.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
namespace LottoProgram
|
||||
{
|
||||
|
||||
class Program
|
||||
{
|
||||
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Lottozo lottozo = new Lottozo();
|
||||
lottozo.bekeres();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user