changed few loops for C++11 range-based for loop

As the title says - I changed few loops for C++11 range-based for loops.