attempted 2-4.cpp