Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 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 donto
  9. {
  10. class Program
  11. { struct korcsolya_tip
  12. {
  13. public string nev;
  14. public string orszagkod;
  15. public double technikai;
  16. public double komponens;
  17. public int hibapont;
  18.  
  19. }
  20. static void Main(string[] args)
  21. {
  22. StreamReader f = new StreamReader("rovidprogram.csv");
  23. korcsolya_tip[] rovid = new korcsolya_tip[50];
  24. int x = 0;
  25. beolvas(f, rovid, out x);
  26. int y = 0;
  27. korcsolya_tip[] donto = new korcsolya_tip[24];
  28. StreamReader g = new StreamReader("donto.csv");
  29. Console.WriteLine();
  30. beolvas(g, donto, out y);
  31. Console.WriteLine("2. feladat: a rövidprogramban {0} induló volt", x);
  32. Console.WriteLine("3. feladat:");
  33. if (bejutott(donto, y))
  34. Console.WriteLine("A magyar versenyző bejutott a döntőbe.");
  35. else
  36. Console.WriteLine("A magyar versenyző nem jutott be");
  37. Console.ReadKey();
  38. }
  39. static bool bejutott(korcsolya_tip[] donto, int y)
  40. {
  41. int i = 0;
  42. while (!(donto[i].orszagkod == "HUN") && i < y)
  43. i++;
  44. if (i < y)
  45. return true;
  46. else
  47. return false;
  48. }
  49. static double osszpont(string neve, korcsolya_tip[] rovid, int x, korcsolya_tip[] donto, int y)
  50. {
  51. double ossz = 0;
  52. int r = 0;
  53. while (!(rovid[].nev == neve) && r < x)
  54. r++;
  55. if (r < x)
  56. ossz = ossz + rovid[r].technikai + rovid[r].komponens - rovid[r].hibapont;
  57. int d = 0;
  58. while (!(donto[r].nev == neve) && d < y)
  59. d++;
  60. if (d < y)
  61. ossz = ossz + donto[d].technikai + donto[d].komponens - donto[d].hibapont;
  62. return ossz;
  63. }
  64.  
  65. private static void beolvas(StreamReader f, korcsolya_tip[] korcsolya, out int x)
  66. {
  67. string elsosor = f.ReadLine();
  68. x = 0;
  69. while (!f.EndOfStream)
  70. {
  71. string sor = f.ReadLine();
  72. string[] darabolt = sor.Split(';');
  73. korcsolya[x].nev = darabolt[0];
  74. korcsolya[x].orszagkod = darabolt[1];
  75. korcsolya[x].technikai = double.Parse(darabolt[2].Replace('.', ','));
  76. korcsolya[x].komponens = double.Parse(darabolt[3].Replace('.', ','));
  77. korcsolya[x].hibapont = int.Parse(darabolt[4]);
  78. x++;
  79. }
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement