Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 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 Footgolf
  9. {
  10. class Program
  11. {
  12.  
  13.  
  14. static List<Adatok> AdatokL;
  15. static void Main(string[] args)
  16. {
  17. Beolvas();
  18. F03();
  19. F04();
  20. FXX();
  21.  
  22.  
  23.  
  24.  
  25. Console.ReadKey();
  26. }
  27.  
  28. private static void FXX()
  29. {
  30.  
  31.  
  32. }
  33.  
  34. private static void F04()
  35. {
  36.  
  37. double nokSzama = 0;
  38.  
  39. for (int i = 0; i < AdatokL.Count; i++)
  40. {
  41. if (AdatokL[i].kategoria == "Noi")
  42. {
  43. nokSzama++;
  44. }
  45. }
  46.  
  47. int w = (int)nokSzama;
  48. int h = AdatokL.Count;
  49.  
  50.  
  51. decimal g = decimal.Divide(w, h);
  52.  
  53. Console.Write("4.feladat: A női versenyzők aránya: {0:P2}",g);
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. }
  62. private static void F03()
  63. {
  64. Console.Write($"3.feladat: Versenyzők száma: {AdatokL.Count}");
  65. Console.WriteLine();
  66. }
  67. private static void Beolvas()
  68. {
  69. AdatokL = new List<Adatok>();
  70.  
  71. var sr = new StreamReader("fob2016.txt", Encoding.UTF8);
  72.  
  73. while (!sr.EndOfStream)
  74. {
  75. AdatokL.Add(new Adatok(sr.ReadLine()));
  76. }
  77.  
  78. sr.Close();
  79. }
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement