Obviously, if you have the choice, you don't need the precise value of i and j during your loop.
So the second option is better, more readable (less indentations). A little optimisation you could do, ( so as not to do the multiplication on each loop iteration):
int iKMax = max_i*max_j;
for (int k = 0; k < iKMax ; ++k)
{
// second way - one loop
}
And always use the prefix operator in loops (++k) cause whatever the object iterated over, it saves up one copying of this object. (cf. C++ Coding Standards: 101 Rules, Guidelines, And Best Practices by Herb Sutter and, Andrei Alexandrescu )