Using System;
Using System.Collections;
Using System.Collections.Generic;
Using System.Text;
Namespace ArrayList collection sort
{
Class Program
{
struct Player
{
public string name;
public int mark;
}
static void Main (string[] args)
{
ArrayList al = new ArrayList ();
Player A = new player ();
Console.WriteLine ("Please Enter your class number");
int n = Convert.ToInt32 (Console.ReadLine ());
for (int i = 0; i < n; i++)
{
Console.WriteLine ("Please Enter Name:");
A.name = Console.ReadLine ();
Console.WriteLine ("Please enter your score");
A.mark = Convert.ToInt32 (Console.ReadLine ());
Al. Add (a);
}
for (int i = 1; i < al. Count; i++)
{
for (int j = 1; J <= al. Count-i; J + +)
{
if ((player) al[j]) .mark< ((player) al[j-1]). Mark)
{
Player temp;
temp = (Player) al[j-1];
Al[j-1] = (Player) al[j];
AL[J] = temp;
}
}
}
for (int i = 0; i < al. Count; i++)
{
Console.WriteLine ((player) al[i]). name+ ((player) al[i]). Mark);
}
Console.ReadLine ();
}curly braces for//static functions
}
}
ArrayList Collection Sort