Advertisement
Guest User

Untitled

a guest
Jul 18th, 2020
1,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. using System;
  2.  
  3. namespace bestplayer
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string command = null;
  10. string previousPlayer = null;
  11. string name = null;
  12. int goals = 0;
  13. int currentGoals = 0;
  14. while (true)
  15. {
  16. command = Console.ReadLine();
  17. if (command != "END")
  18. {
  19. currentGoals = int.Parse(Console.ReadLine());
  20. if (currentGoals != goals)
  21. {
  22. previousPlayer = command;
  23. name = command;
  24. }
  25. else
  26. {
  27. name = previousPlayer;
  28. }
  29. }
  30. else
  31. {
  32. break;
  33. }
  34. if (currentGoals >= goals)
  35. {
  36. goals = currentGoals;
  37. }
  38. if (goals >= 10)
  39. {
  40. break;
  41. }
  42. }
  43. Console.WriteLine($"{name} is the best player!");
  44. if (goals >= 3)
  45. {
  46. Console.WriteLine($"He has scored {goals} goals and made a hat-trick !!!");
  47. }
  48. else
  49. {
  50. Console.WriteLine($"He has scored {goals} goals.");
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement