Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Students
- {
- class Program
- {
- public static void Main()
- {
- List<Students> students = new List<Students>();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string[] info = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
- students.Add(new Students(info[0], info[1], double.Parse(info[2])));
- }
- Console.WriteLine(String.Join("\n", students.OrderByDescending(x => x.Grade).ToList()));
- }
- public class Students
- {
- public Students(string firstName, string secondName, double grade)
- {
- FirstName = firstName;
- SecondName = secondName;
- Grade = grade;
- }
- public string FirstName { get; set; }
- public string SecondName { get; set; }
- public double Grade { get; set; }
- public override string ToString()
- {
- return $"{FirstName} {SecondName}: {Grade:F2}";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement