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; // <<-------- Exception happens here }
Convert.ToInt32
elahe_eli wrote: n = Convert.ToInt32(Console.ReadLine());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)