Hi, i'm having some problems with my program, i'm learning c++ alone with no help so i think it's normal make some mistakes, i want to do a c++ basic calculator and then upgrade as long as i learn new stuff. The problem is that when i enter the value the result is the last number the user input, can you help me?
Thanks and sorry my English,
This is just part of the code, if you need more i will send it,
The reason it outputs the last input is because line 12 is doing assignment so Option will get the value 1 in the first iteration of the loop. 1 is considered true so the if statement will run. The comma operator returns the rightmost argument so line 17 is equivalent to Result = Option * b;. Option is 1 so Result will get the value of b and that is what is printed.