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
Well, it's ugly. But you could use pair.
int main() { for (std::pair<int,float> p(0,0.0f); p.first < 10; p.first += 1, p.second = 2*p.first) { cout << p.second << endl; } }