Changed C++ code to template version, added C++ bubble sort