algebra - solve linear and quadratic style equations in C# -
hi friends need suggestions requirement input in string example x^2 + x^2 + 4x + 9x + x = 10 + 1 * 2 % 4 need slove , find value of x link below link
we need validation of input did need suggestions how can solve these equations using c#
i split equation , create function numeric array , operators trying figure out logic how can process suggestions?
public class calculation { string[] opers = new string[] { "+", "-", "/", "*", "%", "^" }; public string process(string value) { string result = string.empty; string[] equations = value.split('='); calculate(equations[0]); calculate(equations[1]); return result; } private string calculate(string eq) { string result = eq; string variable = string.empty; list<string> numberlist = new list<string>(); list<string> operatorlist = new list<string>(); getlists(eq, ref numberlist, ref operatorlist);
// logic operation return result;
} private void getlists(string value, ref list<string> numberlist, ref list<string> operatorlist) { string[] operatorrarray = value.split(' '); foreach (var item in operatorrarray) { if (opers.contains(item)) { operatorlist.add(item); } else { numberlist.add(item); } } } }
Comments
Post a Comment