Possible Duplicate:
In C++ why can't I write a for() loop like this: for( int i = 1, double i2 = 0;
Why is it so 'hard' to write a for-loop in C++ with 2 loop variables?
#include <iostream>
using namespace std;
int main()
{
for (int i = 0, double j = 3.0; i < 10; i++, j+=0.1)
cout << i << j << endl;
return 0;
}
не компилируется, потому что в блоке инициализатора цикла for -есть два объявления.
Но почему?