added helsinki

This commit is contained in:
szabomarton 2024-01-19 15:06:27 +01:00
parent 6afeb7c999
commit 8da3850875
183 changed files with 7893 additions and 7778 deletions

Binary file not shown.

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;
namespace ConsoleApp1
{
@ -13,6 +14,7 @@ namespace ConsoleApp1
public int sportolok_szama;
public string sportag;
public string versenyszam;
public int olimpiaiPont = 0;
public Adat(int hely, int szam, string sport, string vszam)
{
@ -24,7 +26,23 @@ namespace ConsoleApp1
}
class Program
{
static void Feladat()
static void TobbPont_Kiir(int uszas, int torna)
{
if (uszas > torna)
{
Console.WriteLine("Úszás sportágban szereztek több érmet.");
}
else if (uszas < torna)
{
Console.WriteLine("Torna sportágban szereztek több érmet.");
}
else
{
Console.WriteLine("Egyenlő volt az érmek száma.");
}
}
static void Main(string[] args)
{
FileStream fs = new FileStream("helsinki.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
@ -47,21 +65,72 @@ namespace ConsoleApp1
int arany = 0;
int ezust = 0;
int bronz = 0;
int pontok = 0;
int uszas = 0;
int torna = 0;
foreach (var item in adatok)
{
switch (item.helyezes){
switch (item.helyezes)
{
case 1:
arany++;
pontok += 7;
item.olimpiaiPont = 7;
if (item.sportag == "uszas")
{
uszas++;
}
if (item.sportag == "torna")
{
torna++;
}
goto pont;
case 2:
ezust++;
pontok += 5;
item.olimpiaiPont = 5;
if (item.sportag == "uszas")
{
uszas++;
}
if (item.sportag == "torna")
{
torna++;
}
goto pont;
case 3:
bronz++;
pontok += 4;
item.olimpiaiPont = 4;
if (item.sportag == "uszas")
{
uszas++;
}
if (item.sportag == "torna")
{
torna++;
}
goto pont;
case int n when n > 3 && n < 7 && n != 0:
switch (n)
{
case 4:
arany++;
pontok += 3;
item.olimpiaiPont = 3;
break;
case 5:
pontok += 2;
item.olimpiaiPont = 2;
break;
case 6:
pontok += 1;
item.olimpiaiPont = 1;
break;
default:
break;
}
goto pont;
pont:
pontszerzok++;
@ -69,21 +138,60 @@ namespace ConsoleApp1
default:
break;
}
if (item.helyezes <= 6)
{
pontszerzok++;
}
}
Console.WriteLine("3.feladat:");
Console.WriteLine($"Pontszerző helyezések száma: {pontszerzok}");
Console.WriteLine("4.feladat:");
Console.WriteLine($"Pontszerző helyezések száma: {pontszerzok}");
Console.WriteLine($"Arany: {arany}");
Console.WriteLine($"Ezüst: {ezust}");
Console.WriteLine($"Bronz: {bronz}");
Console.WriteLine($"Összesen: {arany + ezust + bronz}");
Console.WriteLine("5.feladat:");
Console.WriteLine($"Olimpiai pontok száma: {pontok}");
Console.WriteLine("6.feladat:");
TobbPont_Kiir(uszas, torna);
FileStream fileStream = new FileStream("helsinki2.txt", FileMode.Create, FileAccess.Write);
StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.Unicode);
foreach (var item in adatok)
{
string reg = @"kajak.kenu";
Regex re = new Regex(reg);
if (item.sportag == "kajakkenu" || re.IsMatch(item.sportag))
{
streamWriter.WriteLine($"{item.helyezes} {item.sportolok_szama} {item.olimpiaiPont} kajak-kenu {item.versenyszam}");
}
else
{
streamWriter.WriteLine($"{item.helyezes} {item.sportolok_szama} {item.olimpiaiPont} {item.sportag} {item.versenyszam}");
}
}
static void Main(string[] args)
streamWriter.Close();
fileStream.Close();
int legtobb = 0;
int hely = 0;
for (int i = 0; i < adatok.Count; i++)
{
Feladat();
if (adatok[i].sportolok_szama > legtobb)
{
legtobb = adatok[i].sportolok_szama;
hely = i;
}
}
Console.WriteLine("8.feladat:");
Console.WriteLine($"Helyezés: {adatok[hely].helyezes}");
Console.WriteLine($"Sportág: {adatok[hely].sportag}");
Console.WriteLine($"Versenyszám: {adatok[hely].versenyszam}");
Console.WriteLine($"Sportolók száma: {adatok[hely].sportolok_szama}");
}
}
}

Binary file not shown.

View File

@ -1 +1 @@
7f4b213b428f4c013f19137338418ee1f5525793
5bb56c9ef8259863da41b9966ff000324a4ac45ce033dd510671b53b9ecdc07a

View File

@ -5,3 +5,10 @@ C:\Users\szabomarton\Desktop\C#\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleA
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.exe
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.pdb
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\bin\Debug\ConsoleApp1.exe.config
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\bin\Debug\ConsoleApp1.exe
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\bin\Debug\ConsoleApp1.pdb
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.AssemblyReference.cache
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.exe
E:\Házi\Programozás\C#\Suli\ProgaOra\20240117\ConsoleApp1\obj\Debug\ConsoleApp1.pdb