Please explain how this works? What it means by (x++ >5) and all? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5

Please explain how this works? What it means by (x++ >5) and all?

https://code.sololearn.com/c2Gxc4Tc4wr5/?ref=app https://code.sololearn.com/c33062IHpXYJ/?ref=app

6th Dec 2017, 5:24 PM
Qwqwq Rt
Qwqwq Rt - avatar
4 Respostas
+ 4
@McNitro, x++ does the increment in the next line For example: int x=5; cout<<x++; //output 5 ++x does the increment on that line For example: int x=5; cout<<++x; // output 6
6th Dec 2017, 6:56 PM
Qwqwq Rt
Qwqwq Rt - avatar
+ 3
I just read my earlier response...pretty crappy. lol. I wasn't looking for further explanation of Pre vs Post definitions. @Gordie explained it well for @Rame#1, and everyone else. My question is more about implementation. I fail to understand the scenarios in which you would choose to implement one over the other.
7th Dec 2017, 4:25 AM
McNitro
McNitro - avatar
+ 2
@Gordie Adding to Rame's question: What is a simple, "real world" example for differentiating between Pre (++x) and Post (x++)?
6th Dec 2017, 5:56 PM
McNitro
McNitro - avatar
- 1
int, inostren // example
6th Dec 2017, 9:56 PM
Gabe