Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sing System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleApp190
- {
- public class Program
- {
- static void Main(string[] args)
- {
- List<Students> students = new List<Students>();
- int counter = int.Parse(Console.ReadLine());
- for (int i = 1; i <= counter; i++)
- {
- List<string> text = Console.ReadLine().Split().ToList();
- string firstName = text[0];
- string secondName = text[1];
- double grade = double.Parse(text[2]);
- Students student = new Students();
- {
- student.FirstName = firstName;
- student.LastName = secondName;
- student.Grade = grade;
- };
- students.Add(student);
- }
- var printList= students.OrderByDescending(x => x.Grade);
- foreach (var student in printList)
- {
- Console.WriteLine($"{student.FirstName} {student.LastName}: {(student.Grade):f2}");
- }
- }
- }
- public class Students
- {
- public string FirstName { get; set; }
- public string LastName { get; set; }
- public double Grade { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement