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 foci
- {
- class Program
- {
- static void Main(string[] args)
- {
- //1. feladat
- StreamReader file = new StreamReader("meccs.txt");
- int count = Convert.ToInt32(file.ReadLine());
- int[] fordulo = new int[count];
- int[] golhazai = new int[count];
- int[] golvendeg = new int[count];
- int[] golhazaif = new int[count];
- int[] golvendegf = new int[count];
- string[] hazainev = new string[count];
- string[] vendegnev = new string[count];
- int j = 0;
- while (!file.EndOfStream)
- {
- string cache = file.ReadLine();
- string[] cache2 = cache.Split(' ');
- for (int i = 0; i < 7; i++)
- {
- if (i == 0)
- {
- fordulo[j] = Convert.ToInt32(cache2[i]);
- }
- if (i == 1)
- {
- golhazai[j] = Convert.ToInt32(cache2[i]);
- }
- if (i == 2)
- {
- golvendeg[j] = Convert.ToInt32(cache2[i]);
- }
- if (i == 3)
- {
- golhazaif[j] = Convert.ToInt32(cache2[i]);
- }
- if (i == 4)
- {
- golvendegf[j] = Convert.ToInt32(cache2[i]);
- }
- if (i == 5)
- {
- hazainev[j] = cache2[i];
- }
- if (i == 6)
- {
- vendegnev[j] = cache2[i];
- }
- }
- j++;
- }
- //2.feladat
- Console.WriteLine("2.feladat");
- Console.WriteLine();
- Console.WriteLine("fordulo szama: ");
- int fszam = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < count; i++)
- {
- if (fordulo[i] == fszam)
- {
- Console.WriteLine(hazainev[i]+"-"+vendegnev[i]+": "+golhazai[i]+"-"+golvendeg[i]+"("+golhazaif[i]+"-"+golvendegf[i]+")");
- }
- }
- //3. feladat
- Console.WriteLine("3. feladat");
- Console.WriteLine();
- for (int i = 0; i < count; i++)
- {
- if (golhazai[i] > golvendeg[i] && golhazaif[i] < golvendegf[i])
- {
- Console.WriteLine(fordulo[i]+" "+ vendegnev[i]);
- }
- if (golhazai[i] < golvendeg[i] && golhazaif[i] > golvendegf[i])
- {
- Console.WriteLine(fordulo[i]+" "+hazainev[i]);
- }
- }
- //4. feladat
- Console.WriteLine("4. feladat");
- Console.WriteLine();
- Console.WriteLine("csapat neve: ");
- string kertnev = Console.ReadLine();
- //5. feladat
- Console.WriteLine("5. feladat");
- Console.WriteLine();
- int lott = 0;
- int kapott = 0;
- for (int i = 0; i < count; i++)
- {
- if (hazainev[i] == kertnev)
- {
- lott = lott + golhazai[i];
- kapott = kapott + golvendeg[i];
- }
- if (vendegnev[i] == kertnev)
- {
- lott = lott + golvendeg[i];
- kapott = kapott + golhazai[i];
- }
- }
- Console.WriteLine("lőtt: "+lott+" kapott: "+kapott);
- //6. feladat
- Console.WriteLine("6. feladat");
- Console.WriteLine();
- List<int> fordulok = new List<int>();
- for (int i = 0; i < count; i++)
- {
- if (hazainev[i] == kertnev && golhazai[i] < golvendeg[i])
- {
- fordulok.Add(fordulo[i]);
- }
- if (vendegnev[i] == kertnev && golvendeg[i] < golhazai[i])
- {
- fordulok.Add(fordulo[i]);
- }
- }
- Console.WriteLine("A(z) "+kertnev+" csapat a "+fordulok.Min()+". forduloban kapott ki eloszor");
- //7. feladat
- Console.WriteLine("7. feladat");
- Console.WriteLine();
- StreamWriter write = new StreamWriter("stat.txt");
- file.Close();
- write.Close();
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement