Update ex8.cpp