implement ex2.6
implement ex2.5
add ex2.18