+ 5
can you explaine me why the resulte is 1211
#include <iostream> using namespace std; int main() { int x=10; int &y=x; y++; cout << x << y++; return 0; }
2 ответов
+ 2
yeah it acts backwards. Try this:
int x = 0;
std::cout << x++ << x++ << x++;
You'll get 210.
Funny thing
std::cout << ++x << ++x << ++x;
will print 333
0
I think because cout using Insertion operator so that instructions work from right to left such that y++ run first then Value of y is Printed then Increased the value at y ( as using post increment) then print x ! ..