+ 1

set reset value

how to set reset to an integer that will be reset to default when it reaches it's value

28th Sep 2017, 9:05 AM
Sidur Rahman Siam
Sidur Rahman Siam - avatar
2 Réponses
+ 10
I guess the following example help you to get the point. int i = 0; // your target variable with default value of 0 cout << i << endl; // i = 0 // you set the value to 10 inside this for loop // to index some operation inside the body of // for loop and it is gonna decrement the value of i // in each cycle until it reaches to 0.( reset to default) for (i = 10; i > 0; --i) { /* some operation*/ } cout << i << endl; // i = 0
28th Sep 2017, 9:37 AM
Babak
Babak - avatar
+ 1
Can you explain your question please ? I did not understand :/
28th Sep 2017, 9:10 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar