practice C++ subprogramming