Add project files.
This commit is contained in:
parent
560d91073c
commit
311d9b790f
29
KartyaOszto/Jatekos.cs
Normal file
29
KartyaOszto/Jatekos.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KartyaOszto
|
||||
{
|
||||
class Jatekos
|
||||
{
|
||||
public string nev;
|
||||
public Kartyalap[] lapok;
|
||||
private int felvett;
|
||||
|
||||
public Jatekos(string nev, int lapszam)
|
||||
{
|
||||
lapok = new Kartyalap[lapszam];
|
||||
this.nev = nev;
|
||||
felvett = 0;
|
||||
}
|
||||
|
||||
public void Felvesz(List<Kartyalap> laplista)
|
||||
{
|
||||
foreach (Kartyalap kl in laplista)
|
||||
{
|
||||
lapok[felvett] = kl;
|
||||
felvett++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
KartyaOszto/KartyaCsomag.cs
Normal file
35
KartyaOszto/KartyaCsomag.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KartyaOszto
|
||||
{
|
||||
class KartyaCsomag
|
||||
{
|
||||
public Kartyalap[] lapok;
|
||||
|
||||
public KartyaCsomag()
|
||||
{
|
||||
//Az 52 elemű tömb létrehozása
|
||||
lapok = new Kartyalap[52];
|
||||
//Kártyalap objektumok elkészítése
|
||||
string[] szinek = {"pikk","kőr","káró","treff" };
|
||||
string[] ertekek = {"2","3","4","5","6","7","8","9","10","J","D","K","A"};
|
||||
int laphely = 0;
|
||||
foreach (string szin in szinek)
|
||||
{
|
||||
foreach (string ertek in ertekek)
|
||||
{
|
||||
Kartyalap lap = new Kartyalap();
|
||||
lap.szin = szin;
|
||||
lap.ertek = ertek;
|
||||
lapok[laphely] = lap;
|
||||
laphely++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
8
KartyaOszto/KartyaOszto.csproj
Normal file
8
KartyaOszto/KartyaOszto.csproj
Normal file
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
19
KartyaOszto/Kartyalap.cs
Normal file
19
KartyaOszto/Kartyalap.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KartyaOszto
|
||||
{
|
||||
class Kartyalap
|
||||
{
|
||||
public string szin;
|
||||
public string ertek;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Szín: {szin} - Érték: {ertek}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
54
KartyaOszto/OsztoProgram.cs
Normal file
54
KartyaOszto/OsztoProgram.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
|
||||
namespace KartyaOszto
|
||||
{
|
||||
class OsztoProgram
|
||||
{
|
||||
static int jatekosSzam;
|
||||
static int jatekosLapSzam;
|
||||
static int hanyasaval;
|
||||
static Jatekos[] jatekosok;
|
||||
static KartyaCsomag pakli;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
pakli = new KartyaCsomag();
|
||||
Console.WriteLine($"Lapok száma: {pakli.lapok.Length}");
|
||||
//Console.WriteLine($"10. Lap: {pakli.lapok[9]}");
|
||||
//Console.WriteLine($"52. Lap: {pakli.lapok[51]}");
|
||||
Bekeres();
|
||||
if(jatekosSzam*jatekosLapSzam<=52 && jatekosLapSzam%hanyasaval==0)
|
||||
{
|
||||
jatekosok = new Jatekos[jatekosSzam];
|
||||
for (int i = 0; i < jatekosSzam; i++)
|
||||
{
|
||||
string jnev = "Játékos-" + i;
|
||||
jatekosok[i] = new Jatekos(jnev,jatekosLapSzam);
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
Console.WriteLine("Az osztás a megadott adatokkal nem elvégezhető!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void Bekeres()
|
||||
{
|
||||
Console.WriteLine("Hány játékos legyen?");
|
||||
jatekosSzam = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Hány lapja legyen egy játékosnak?");
|
||||
jatekosLapSzam = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Hányasával legyen osztás?");
|
||||
hanyasaval = int.Parse(Console.ReadLine());
|
||||
}
|
||||
|
||||
static void Osztas()
|
||||
{
|
||||
foreach (Jatekos j in jatekosok)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
OOPgyakorlok.sln
Normal file
25
OOPgyakorlok.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}") = "KartyaOszto", "KartyaOszto\KartyaOszto.csproj", "{3B2D2794-EA0A-4863-B594-87FFDC8E9605}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {21923BE9-EED3-4337-BF6B-FD23FA7FBCB9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Reference in New Issue
Block a user