using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading.Tasks; namespace Helsinki1952 { internal class Program { public static List helsinkiList; static void Main(string[] args) { Feladat2(); Feladat3(); Feladat4(); Feladat5(); } private static void Feladat5() { int opont = 0; foreach (Olimpia hs in helsinkiList) { if (hs.helyezes == 1) { opont += 7; } else if (hs.helyezes == 2) { opont += 5; } else if (hs.helyezes == 3) { opont += 4; } else if (hs.helyezes == 4) { opont += 3; } else if (hs.helyezes == 5) { opont += 2; } else { opont += 1; } } Console.WriteLine("5. feladat:"); Console.WriteLine($"Olimpiai pontok száma: {opont}"); } private static void Feladat4() { int arany = 0; int ezust = 0; int bronz = 0; foreach (Olimpia hs in helsinkiList) { if (hs.helyezes == 1) { arany++; } else if (hs.helyezes == 2) { ezust++; } else if (hs.helyezes == 3) { bronz++; } else { break; } } int osszes = arany + ezust + bronz; Console.WriteLine("4. feladat:"); Console.WriteLine($"Arany: {arany}"); Console.WriteLine($"Ezust: {ezust}"); Console.WriteLine($"Bronz: {bronz}"); Console.WriteLine($"Összesen: {osszes}"); } private static void Feladat3() { Console.WriteLine("3. feladat:"); Console.WriteLine($"Pontszerző helyezések száma: {helsinkiList.Count}"); } private static void Feladat2() { helsinkiList = new List(); StreamReader streamReader = new StreamReader(@"..\..\helsinki.txt"); while (!streamReader.EndOfStream) { helsinkiList.Add(new Olimpia(streamReader.ReadLine())); } streamReader.Close(); } } }