+ 1
set reset value
how to set reset to an integer that will be reset to default when it reaches it's value
2 Answers
+ 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
+ 1
Can you explain your question please ? I did not understand :/