You can define 2 variables of the same type in a for loop:
int main() { for (int i = 0, j = 0; i < 10; i += 1, j = 2*i) { cout << j << e
This will make the iterator (or in this case, float) disappear when it's no more needed:
int main() { // some code... { float j = 0.0; for (int i = 0; i < 10; i += 1, j = 2*i) { cout << j << endl; } } // more code... }