Iterations in c++