nims11
BIOS Terminator
[/COLOR]Output Problem
cout<<a++<<a++<<b--<<--b<<++b<<--b;
I m havin problem in assumin the ouput of such syntax. Usullly i get unexpected results. Any reason for tht and way to encounter it?
let a=1 and b=2 before this 'cout' statement.
then here is what happens when "cout<<a++<<a++<<b--<<--b<<++b<<--b;" is executed.
a++
output a; a+=1;
a is now 2, b is now 2;
output status : 1
a++
output a; a+=1;
a is now 3, b is now 2;
output status : 12
b--
output b; b-=1;
a is now 3, b is now 1;
output status : 122
--b
b-=1;output b;
a is now 3, b is now 0;
output status : 1220
++b
b+=1;output b;
a is now 3, b is now 1;
output status : 12201
--b
b-=1;output b;
a is now 3, b is now -1;
output status : 122010
Final Output- 122010.