I'm making a calculator as a school project.
It works by solving each 2 members of an operation ;
Concretely, if I type "2+3-5+4-2+6-7+1", it calculates "(2+3)-(5+4)-(2+6)-(7+1)"
Why is it wrong ?
2026-04-03 14:50:26.1775227826
Solved Why is this way of adding not working?
40 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
The error is the distributive law, for example consider $-7+1$: your program will display $-(7+1)=-8$, but this is incorrect. Instead, if you use the distributive law, you have: $$-7+1=-(7-1)=-6$$