New course! Every coder should learn Generative AI!
Try a free lesson0
Help with linear equation code?
The problem is described in more detail inside the code, but the basic idea is that when the button which toggles "+" to "-" is set to "-" the equations solving behaves very strangely. Can anyone help me with this https://code.sololearn.com/W1V4vtl09Qgy/?ref=app Example of bug (compare the two pictures): https://uploadpie.com/sGYo8s https://uploadpie.com/C88beB
1 Answer
+ 1
You can make a string that when the button is clicked, + will change - by replacing it from the string. Then when a solve button is pressed, you make a condition.
If its +, you replace the result with this.
<> means you have to replace this.
Given the value of ax + b = c
var result = eval((<c>-<b>)/<a>);
If its -,
var result = eval((<c>+<b>)/<a>)