implement triangle.cpp