First working version of c++for