adding C++ loops