ISO C++ forbids declaration of 'i' with no type

#include <iostream>
using namespace std;

int main()
{
for (register i = 1; i <= 9; ++i)
for (register j = 1; j <= 9; ++j)
cout << i << " x " << j << " = " << i*j << '\n';

return 0;
}

I keep getting two errors saying ISO c++ forbids declaration of 'i' with no type and another one that says ISO c++ forbids declaration of 'j' with no type. I can't figure out what's wrong. I am new to this by the way and doing sample programs and i haved it typed out exactly how they do. Any help would be appreciatied! Thanks.
Don't use register...it's very outdated and probably not supported very well (if at all). Use an actual data type instead.
It's best to always use integer values for loopcounters. Other values may act strange (eg.: a variable of type double with the value 0 after calculations often has a value like 1.42392e-9. If you use that variable in a condition like if (variable==0.0) it returns false.)
As said before: always use iterator of integer type or special iterator defined for some container (STL).
Topic archived. No new replies allowed.