• Share this text:
Report Abuse
Untitled - posted by guest on 17th August 2020 04:07:45 PM

using System;

using System.Collection.Generic;


public class List

{

    static public void Main ()

    {

        Console.WriteLine("How many students are in your class?");

   int num = Convert.ToInt32(Console.ReadLine());

   

   List<string> students = new List<string>();

   

   Console.WriteLine("Please type in their names: ");

   

   for (int i = 0;i < num;i++)

   {

    students.Add(Console.ReadLine());

   }

   

   Console.WriteLine("--------------------");

   

   List.Sort(students);

   

   for (int i = 0;i < num;i++)

   {

    int rank = i + 1;

   

    Console.WriteLine(rank + "/ " + students[i]);

   }

   

   Console.ReadKey();

    }

}


Report Abuse

Login or Register to edit or copy and save this text. It's free.