Hej , mam nastepujacy problem , musze napisac program tworzacy 10 przypadkowych punktow (x,y) i wypisujacy je na tablicy przed i po sortowaniu , morduje sie z tym zadaniem juz kilka godzin wiec prosze forum o pomoc ,
oto moje dotychczasowe wypociny ;
namespace zad2
{
public class Point
{
public int X { get; set; }
public int Y { get; set; }
public Point(int x, int y)
{
this.X = x;
this.Y = y;
}
public string ToString()
{
return X + "," + Y;
}
}
public class ArrayListTest
{
public static void Main(string[] args)
{
ArrayList AL = new ArrayList();
Random R = new Random();
for (int i = 0; i < 10; i++)
{
Point p = new Point(R.Next(50), R.Next(50));
AL.Add(p);
}
PrintValues(AL);
AL.Sort();
PrintValues(AL);
}
public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.WriteLine("{0}", obj);
Console.WriteLine();
Console.Read();
}
}
}