0

What happens when multiple values are cascaded with cout?

The answer is not coming correct as we predict!!

3rd Mar 2017, 5:47 AM
Abdul Khan
6 Respostas
+ 1
in that case, it should print out 5,3 such that y-- is postfix so it will happen after ttue print. the next time the variable is called it would be 1 less. the next --y immediately reduces it because it is prefix so it does 5 waits after 4 -> 3 right away hope this helps!!
3rd Mar 2017, 9:07 AM
Michael Szczepanski
Michael Szczepanski - avatar
0
cascaded? could you elaborate... there are Many ways to manipulate and use the cout in c++
3rd Mar 2017, 8:47 AM
Michael Szczepanski
Michael Szczepanski - avatar
0
using the increament and decreament operators in single line. For example: cout<<y--<<", "<<--y; say y = 5; then what is the output?
3rd Mar 2017, 9:05 AM
Abdul Khan
0
Try it yourself the answer is not coming that!
3rd Mar 2017, 9:21 AM
Abdul Khan
0
are you trying it in Code Playground? pretty sure their shits busted bc I just wrote x = 5; cout x++ and they told me it was 4. I've overloaded the x++ and ++x operators, Many times. trust me 5 , 3 is the output.
3rd Mar 2017, 9:29 AM
Michael Szczepanski
Michael Szczepanski - avatar
0
Yes, I am trying in Code playground but output shows: 4,3. Is something wrong with sololearn? Does the output differ on Computer and app?
3rd Mar 2017, 9:37 AM
Abdul Khan