Advertisement
finySTAR

rekordok

Mar 28th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace lift
  9. {
  10.     class adatok
  11.     {
  12.         public int ora;
  13.         public int perc;
  14.         public int masodperc;
  15.         public int alaplvl;
  16.         public int iranylvl;
  17.         public int csapat;
  18.     }
  19.     class Program
  20.     {
  21.         static void Main(string[] args)
  22.         {
  23.             Console.WriteLine("1.Feladat");
  24.             StreamReader olvas = new StreamReader(@"C:\Users\finyw\Desktop\Erettsegi practice\e_infofor_09maj_fl\Forrasok\4_Lift\igeny.txt", Encoding.Default);
  25.             List<adatok> igenyek = new List<adatok>();
  26.             int j = 0;
  27.             while (!olvas.EndOfStream)
  28.             {
  29.                 string sor = olvas.ReadLine();
  30.                 string[] elemek = sor.Split(' ');
  31.                 igenyek.Add(new adatok());
  32.                 igenyek[j].ora = Convert.ToInt32(elemek[0]);
  33.                 igenyek[j].perc = Convert.ToInt32(elemek[1]);
  34.                 igenyek[j].masodperc = Convert.ToInt32(elemek[2]);
  35.                 igenyek[j].alaplvl = Convert.ToInt32(elemek[3]);
  36.                 igenyek[j].iranylvl = Convert.ToInt32(elemek[4]);
  37.                 igenyek[j].csapat = Convert.ToInt32(elemek[5]);
  38.                 j++;
  39.             }
  40.             Console.WriteLine("2.Feladat");
  41.             Console.Write("Kérem a lift indulásihelyét: ");
  42.             int szint = Convert.ToInt32(Console.ReadLine());
  43.             Console.WriteLine("3.Feladat");
  44.             for (int i = 0; i < 100; i++)
  45.             {
  46.                 if (szint==i)
  47.                 {
  48.                     Console.WriteLine("A lift a {0}. szintenáll az utolsó igény teljesítése után.", szint);
  49.                 }
  50.             }
  51.             Console.WriteLine("4.Feladat");
  52.             int min = igenyek[4].iranylvl;
  53.             for (int i = 0; i < igenyek.Count; i++)
  54.             {
  55.                 if (min<igenyek[i].iranylvl)
  56.                 {
  57.                     min = igenyek[i].iranylvl;
  58.  
  59.                 }
  60.             }
  61.             int max = igenyek[4].iranylvl;
  62.             for (int i = 0; i < igenyek.Count; i++)
  63.             {
  64.                 if (max>igenyek[i].iranylvl)
  65.                 {
  66.                     max = igenyek[i].iranylvl;
  67.                 }
  68.             }
  69.             Console.WriteLine("A legnagyobb utólsó igény:{0} volt",max);
  70.             Console.WriteLine("A legkisebb utolsó igény:{0} volt",min);
  71.             Console.ReadLine();
  72.         }
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement