New course! Every coder should learn Generative AI!
Try a free lesson+ 3
Replace =+ with +=
0
Joshua J. Spencer
+<number> equals to <number> * 1
-<number> equals to <number> * (-1)
"sin_ex =+ middle_stream" equals to "sin_ex = (4 * 1)", here we have accidentally assigned value of middle_stream (4) into sin_ex, which explains the output 16, because ruthi_elke = sin_ex (4) * middle_stream (4).
On the other hand ...
<number1> += <number2> means <number1> = <number1> + <number2>.
Note here, that if <number2> is an expression, then the whole expression will be evaluated first before the result is added into <number1>. e.g. "sin_ex += middle_stream * 2", here "middle_stream * 2" will be calculated first before its result is added to sin_ex. Simply put, anything following the += operator will be evaluated first, the evaluation/calculation result will then be added to the operand preceding the += operator.
To print the output of "sin_ex += middle_stream" calculation result you can do the usual way, like so:
cout << (sin_ex += middle_stream);
Hth, cmiiw