public LogicExpression(string exp, int level, Table table) { _Expression = exp; _Level = level; truthTable = table; truthTable.AddBranch(this); ParseExpression(); }
static void Main(string[] args) { Console.WindowWidth = 200; //declare variables string expression; bool stop = false; Console.WriteLine("\t\tTRUTH TABLE GENERATOR"); Console.WriteLine("\t\tBy Nathan Beattie"); Console.WriteLine("Type \"guide\" for instructions on how to use this guide, \"exit\" to quit, or type your expression below"); //get input while (!stop) { Console.Write("Please enter an expression: "); expression = Console.ReadLine(); if (expression == "guide") { DisplayGuide(); } else if (expression == "exit") { return; } else { Table truthTable = new Table(); LogicExpression logEx = new LogicExpression(expression, 0, truthTable); truthTable.TestStuff(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Would you like to test another expression? (y for yes, anything else for no)"); string s = Console.ReadLine(); if (s != "y" && s != "Y") { stop = true; } } } }