Hi,
Please help me out, I can't understand whats the problem in this code.
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NFAtoDFA
{
class Program
{
public static string[,] ArrOfAllStates = new string[11, 3];
static string state;
static string s3;
public static void Main(string[] args)
{
ArrOfAllStates[0, 0] = "1,2,4,7";
ArrOfAllStates[0, 1] = null;
ArrOfAllStates[0, 2] = null;
ArrOfAllStates[1, 0] = "2,4";
ArrOfAllStates[1, 1] = null;
ArrOfAllStates[1, 2] = null;
ArrOfAllStates[2, 0] = null;
ArrOfAllStates[2, 1] = "3";
ArrOfAllStates[2, 2] = null;
ArrOfAllStates[3, 0] = "1,2,4,6,7";
ArrOfAllStates[3, 1] = null;
ArrOfAllStates[3, 2] = null;
ArrOfAllStates[4, 0] = null;
ArrOfAllStates[4, 1] = null;
ArrOfAllStates[4, 2] = "5";
ArrOfAllStates[5, 0] = "1,2,4,6,7";
ArrOfAllStates[5, 1] = null;
ArrOfAllStates[5, 2] = null;
ArrOfAllStates[6, 0] = "1,2,4,7";
ArrOfAllStates[6, 1] = null;
ArrOfAllStates[6, 2] = null;
ArrOfAllStates[7, 0] = null;
ArrOfAllStates[7, 1] = "8";
ArrOfAllStates[7, 2] = null;
ArrOfAllStates[8, 0] = null;
ArrOfAllStates[8, 1] = null;
ArrOfAllStates[8, 2] = "9,10";
ArrOfAllStates[9, 0] = null;
ArrOfAllStates[9, 1] = null;
ArrOfAllStates[9, 2] = "10";
ArrOfAllStates[10, 0] = null;
ArrOfAllStates[10, 1] = null;
ArrOfAllStates[10, 2] = null;
Move(E_Closure(0));
}
public static string E_Closure(int i)
{
Console.Write("Enter state name:");
state = Console.ReadLine();
state = ArrOfAllStates[i, 0];
i++;
return state;
}
public static void Move(string s)
{
string[] str = s.Split(',');
string[] s1=new string[str.Length];
for(int m=0;m<str.Length;m++)
s1[m] = ArrOfAllStates[int.Parse(str[m]), 1]+"," + E_Closure(int.Parse(ArrOfAllStates[int.Parse(str[m]), 1]));
foreach (string s2 in s1)
s3 = s2;
Console.WriteLine("State= {" + s3 + " }");
}
}
}