math - How to solve systems of equations in three variables using c# -
i try make use help, learn better when see whole code in front of me explanation. beginner , if could, use methods understand them better because learning. have far.
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace three_dimensions { class program { static void main(string[] args) { console.writeline("input x"); var g = console.readline(); int x = convert.toint32(g); console.writeline("input y"); var f = console.readline(); int y = convert.toint32(f); console.writeline("input z"); var l = console.readline(); int z = convert.toint32(l); console.writeline(x + " " + y + " " + z); console.readline(); console.writeline("now on second equation. press enter"); console.readline(); console.writeline("input x"); var p = console.readline(); int = convert.toint32(p); // variables b c console.writeline("input y"); var h = console.readline(); int b = convert.toint32(h); console.writeline("input z"); var v = console.readline(); int c = convert.toint32(v); console.writeline(x + " " + y + " " + z); console.writeline(a + " " + b + " " + c); console.readline(); console.writeline("now on third equation. press enter"); console.readline(); console.writeline("input x"); var plol = console.readline(); int ab = convert.toint32(plol); console.writeline("input y"); //variables ab bb cb var lol = console.readline(); int bb = convert.toint32(lol); console.writeline("input z"); var olo = console.readline(); int cb = convert.toint32(olo); console.writeline(x + " " + y + " " + z); console.writeline(a + " " + b + " " + c); console.writeline(ab + " " + bb + " " + cb); console.readline(); console.writeline("thank process begins"); } } }
there nothing wrong code, optimized little bit, consider post on code review instead. you'll maybe more useful answers there.
you can use input loop ease "ui"-code this:
list<int[]> inputs = new list<int[]>(); string[] headers = { "first equation: ", "second equation: ", "third equation: " }; string[] prompts = { "enter x: ", "enter y: ", "enter z: " }; (int = 0; < 3; i++) { int[] input = new int[3]; console.writeline(headers[i]); (int j = 0; j < 3; j++) { console.write(prompts[j]); input[j] = int.parse(console.readline()); } inputs.add(input); console.writeline(); } foreach (var input in inputs) { console.writeline(string.join(" + ", input)); }
there many ways solve system of 3 equations. come question on how implement in c# when have chosen 1 , tried code self.
Comments
Post a Comment