attempted 2-5.cpp