#include<iostream.h>
void main()
{
int A=5,B=10;
for(int I=1;I<=2;I++)
{
cout<<"Line1="<<A++<<"&"<<B-2<<endl;
cout<<"Line2="<<++B<<"&"<<A+B<<endl;
}
}
The output of this program is
Line1=5&8
Line2=11&16
Line1=6&9
Line2=12&18
I thought that it will produce 17 and 19 in place of the 16 and 18 in the second and fourth lines of the output. This is because, in the first run of the loop, first the value of A is 5 and the first command prints 5&8 and should increment the value of A by 1, making it 6. In the second command it should print 11&(6+11) which should print 11&17 but the output is not that.
Where is the loophole in my reasoning??