I have the following code:
#include<iostream>
using namespace std;
int main()
{
int x=3;
cout<<x++<<++x<<x++<<++x<<endl;
return 0;
}
the output should be 3557 but it is 6747. why???
Also:
#include<iostream>
using namespace std;
int main()
{
int x=3;
cout <<x++<<endl;
cout<<++x<< endl;
cout<<x++<< endl;
cout<<++x<< endl;
return 0;
}
The above code gives: 3 5 5 7 (every digit in new line) Can anyone explain why?