A homework of C++ programming