Advertisement
svetlyoek

Untitled

Feb 27th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. using 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. string FirstName = firstName;
  22. string LastName = secondName;
  23. double Grade = grade;
  24. }
  25.  
  26. students.Add(student);
  27. }
  28.  
  29. students.OrderByDescending(x => x.Grade);
  30. foreach (Students student in students)
  31. {
  32. Console.WriteLine($"{student.FirstName} {student.LastName}: {student.Grade}");
  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