Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace prglistatitanic
- {
- class helsinki_tip
- {
- public int helyezes, csapattagokszama;
- public string sportag, versenyszam;
- public helsinki_tip(string sor)
- {
- string[] darabolt = sor.Split(' ');
- this.helyezes = int.Parse(darabolt[0]);
- this.csapattagokszama = int.Parse(darabolt[1]);
- this.sportag = darabolt[2];
- this.versenyszam = darabolt[3];
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- List<helsinki_tip> helsinki = new List<helsinki_tip>();
- StreamReader f = new StreamReader("helsinki.txt");
- while (!f.EndOfStream)
- {
- helsinki.Add(new helsinki_tip(f.ReadLine()));
- }
- Console.WriteLine("3.feladat:\n" + helsinki.Count + "db");
- int pontszerzohelyek = 0;
- foreach (helsinki_tip elem in helsinki)
- pontszerzohelyek += elem.helyezes;
- int elso = 0;
- int masodik = 0;
- int harmadik = 0;
- for (int i = 0; i < helsinki.Count; i++)
- {
- if (helsinki[i].helyezes == 1)
- {
- elso++;
- }
- }
- for (int i = 0; i < helsinki.Count; i++)
- {
- if (helsinki[i].helyezes == 2)
- {
- masodik++;
- }
- }
- for (int i = 0; i < helsinki.Count; i++)
- {
- if (helsinki[i].helyezes == 3)
- {
- harmadik++;
- }
- }
- int ossz = masodik + elso + harmadik;
- Console.WriteLine("4.Feladat:\nArany:{0}\nEzüst{1}\nBronz{2}\nÖssz:{3}", elso, masodik, harmadik, ossz);
- int egy = 0;
- int ketto = 0;
- int harom = 0;
- int negy = 0;
- int ot = 0;
- int hat = 0;
- for (int i = 0; i < helsinki.Count; i++)
- {
- if (helsinki[i].helyezes == 1)
- {
- egy += 7;
- }
- if (helsinki[i].helyezes == 2)
- {
- ketto += 5;
- }
- if (helsinki[i].helyezes == 3)
- {
- harom += 4;
- }
- if (helsinki[i].helyezes == 4)
- {
- negy += 3;
- }
- if (helsinki[i].helyezes == 5)
- {
- ot += 2;
- }
- if (helsinki[i].helyezes == 6)
- {
- hat += 1;
- }
- }
- Console.WriteLine("5.Feladat:\nElért Olimpiai pontok száma:{0}", egy + ketto + harom + negy + ot + hat);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement