I have a piece of code that was written by someone else before the New ISO come into effect.
The for
LOOP in for (pa=a.begin(), i=0; pa != a.end(); ++pa)
has a little trouble executing because of the i=0
part of the syntax. Also, I had to prefix the other for
loop syntaxes to read for ( int i .....)
with the int
before the i
. However, I don't know how to fix the int i=0
in this line: for (pa=a.begin ( ), i=0; pa != a.end ( ); ++pa)
. Please help me out.
for ( int i = 0; pa != a.end(); ++pa)
*pa = ++i;
for (int i=0; i<10; i++)
std::cout << "a[" << i << "]=" << a[i] << std::endl;
// int i; // note that this will work, but I do not want this extra line.
for (pa=a.begin(), i=0; pa != a.end(); ++pa)
std::cout << "a[" << i++ << "]=" << *pa << std::endl;