how to print last increment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to print last increment

i use increment in gcd program

21st Oct 2016, 5:25 PM
KG Feignh
KG Feignh - avatar
2 Answers
+ 2
You could also just use cout << i++; This way you are printing I, THEN incrementing it. for example. int i = 2; cout << i++ << endl; cout << i << endl; what is printed: 2 3
21st Oct 2016, 8:03 PM
Zeke Williams
Zeke Williams - avatar
+ 1
I think what you want is this cout<<++i; but if not, be a little more specific
21st Oct 2016, 6:20 PM
Osvaldo López Ruiz
Osvaldo López Ruiz - avatar