Update final_ex_1002.cpp