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 donto
- {
- class Program
- { struct korcsolya_tip
- {
- public string nev;
- public string orszagkod;
- public double technikai;
- public double komponens;
- public int hibapont;
- }
- static void Main(string[] args)
- {
- StreamReader f = new StreamReader("rovidprogram.csv");
- korcsolya_tip[] rovid = new korcsolya_tip[50];
- int x = 0;
- beolvas(f, rovid, out x);
- int y = 0;
- korcsolya_tip[] donto = new korcsolya_tip[24];
- StreamReader g = new StreamReader("donto.csv");
- Console.WriteLine();
- beolvas(g, donto, out y);
- Console.WriteLine("2. feladat: a rövidprogramban {0} induló volt", x);
- Console.WriteLine("3. feladat:");
- if (bejutott(donto, y))
- Console.WriteLine("A magyar versenyző bejutott a döntőbe.");
- else
- Console.WriteLine("A magyar versenyző nem jutott be");
- Console.ReadKey();
- }
- static bool bejutott(korcsolya_tip[] donto, int y)
- {
- int i = 0;
- while (!(donto[i].orszagkod == "HUN") && i < y)
- i++;
- if (i < y)
- return true;
- else
- return false;
- }
- static double osszpont(string neve, korcsolya_tip[] rovid, int x, korcsolya_tip[] donto, int y)
- {
- double ossz = 0;
- int r = 0;
- while (!(rovid[].nev == neve) && r < x)
- r++;
- if (r < x)
- ossz = ossz + rovid[r].technikai + rovid[r].komponens - rovid[r].hibapont;
- int d = 0;
- while (!(donto[r].nev == neve) && d < y)
- d++;
- if (d < y)
- ossz = ossz + donto[d].technikai + donto[d].komponens - donto[d].hibapont;
- return ossz;
- }
- private static void beolvas(StreamReader f, korcsolya_tip[] korcsolya, out int x)
- {
- string elsosor = f.ReadLine();
- x = 0;
- while (!f.EndOfStream)
- {
- string sor = f.ReadLine();
- string[] darabolt = sor.Split(';');
- korcsolya[x].nev = darabolt[0];
- korcsolya[x].orszagkod = darabolt[1];
- korcsolya[x].technikai = double.Parse(darabolt[2].Replace('.', ','));
- korcsolya[x].komponens = double.Parse(darabolt[3].Replace('.', ','));
- korcsolya[x].hibapont = int.Parse(darabolt[4]);
- x++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement