+ 1

explain me this please?

explain me this please? #include <iostream> using namespace std; int main() { int x = 4; int y= ++x; cout << y++<<y++<<y++<<"\n"<<++y; cout<<"\n"<< x++<<x++<<x++<<"\n"<<++x; return 0; } //post fix means using the variable first, then increment it but y++ is incrementing it first?same is with x ++ why does it happenning?, explain?

25th May 2017, 4:42 PM
Jayant
Jayant - avatar
1 Antwoord
+ 8
I think you should write them in separated lines such as : cout<<y++; cout<<++y; //that will be clear for you ...
26th May 2017, 8:28 AM
Enas Emad
Enas Emad - avatar