Update ex2.cpp