1) add comments
2) for 3.cpp, fixed a bug