Are time complexity of followng codes equivalent?
I'm not familiar with C++ but it looks like that both codes are equivalent, for loop and while loop has the same power.

In your examples, in both cases you first you initial the variable k, and  the loop doesn't stop as coud() condition holds, inside the loop there is a call to f(); method, and finally to next();.