i write a simple code but i have an strange exception .
int[] vertex;
int[,] AMatrix;
int[,] AdjacencyMatrix;
int Length;
public void SetVertex()
{
Console.WriteLine("Please enter the number of vertices");
int n = Convert.ToInt32(Console.ReadLine());
while (n < 2)
{
Console.WriteLine("You must enter a number greater than 1\n plz enter another one:");
n = Convert.ToInt32(Console.ReadLine());
}
vertex = new int[n];
for (int i = 0; i <= n-1; i++)
vertex[i] = i;
}
public void SetEdges()
{
AdjacencyMatrix = new int[vertex.Length, vertex.Length];
for (int i = 0; i < vertex.Length; i++)
for (int j = 0; j < vertex.Length; j++)
AdjacencyMatrix[i, j] = 0;
Console.WriteLine("please enter the number of the edges:");
int e = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < e; i++)
{
Console.WriteLine("from ");
int s = 0;
s = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("to ");
int d = 0;
d = Convert.ToInt32(Console.ReadLine());
AdjacencyMatrix[s, d] = 1;
}
in line that i bold it i have an exception i cant understand, please help me to remove this exception :(