Advertisement
svetlyoek

Untitled

Feb 27th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. sing System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace ConsoleApp190
  6. {
  7. public class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. List<Students> students = new List<Students>();
  12. int counter = int.Parse(Console.ReadLine());
  13. for (int i = 1; i <= counter; i++)
  14. {
  15. List<string> text = Console.ReadLine().Split().ToList();
  16. string firstName = text[0];
  17. string secondName = text[1];
  18. double grade = double.Parse(text[2]);
  19. Students student = new Students();
  20. {
  21. student.FirstName = firstName;
  22. student.LastName = secondName;
  23. student.Grade = grade;
  24. };
  25.  
  26. students.Add(student);
  27. }
  28. var printList= students.OrderByDescending(x => x.Grade);
  29.  
  30. foreach (var student in printList)
  31. {
  32. Console.WriteLine($"{student.FirstName} {student.LastName}: {(student.Grade):f2}");
  33. }
  34.  
  35.  
  36.  
  37. }
  38. }
  39. public class Students
  40. {
  41. public string FirstName { get; set; }
  42. public string LastName { get; set; }
  43. public double Grade { get; set; }
  44.  
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement